diff --git a/.gitignore b/.gitignore index dbbb3119e..f06df65b9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ scripts/output/*.md .env .DS_Store .idea/* +/reference/.stoplight/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f5c0b131..0104121e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,6 +105,14 @@ Good practices: - Authenticate `rdme` tool by running: `rdme login` command; you can check if it works using the command `rdme whoami`; what should result: `You are currently logged in as xxx@voucherify.io to the voucherify project.` - Copy `.env.example` to `.env` and add to this file your personal API Key created in readme.io: `dashboard` > `configuration` > `API Keys` +### Images in .md files + +- There are 2 ways to add images to .md files: + - with `[block:image]` component, [see example in Quickstart.md](docs/guides/getting_started/Quickstart.md) + - with link declaration, for example `![Welcome Diagram](https://files.readme.io/6070078-welcome-diagram.png "Welcome Diagram")` +- At first always point to assets img folder, for example: `![Recent Changes](../../assets/img/guides_getting_started_quickstart_recent_changes_4.png "Recent Changes")` +- This path declaration will be automatically updated to url link while during `npm run manage-project` command. + ### Development process - For each change / pull request, create your copy of the current documentation, where you will test changes. - Create your own branch from `master`, diff --git a/Changelog.md b/Changelog.md index da4deaaf3..dbc7ce1a7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,175 @@ # Changelog +## 20230924 + +- Updated `docs/guides/getting_started/Quickstart.md` + + +## 20230923 - Endpoint bugfixes and improvements + +- Described customer object in Track custom event endpoint +- Fixed qualifications filters (missing and wrong properties) +- Fixed wrong name of rollback object in Rollback Stackable Redemptions response + +| **API** | **Endpoint** | **Slug** | +|---|---------------------------------|----------------------| +| **Events** | Track Custom Event | track-custom-event | true | +| **Qualifications** | Examine Qualification | examine-qualification | true | +| **Stackable Discounts** | Rollback Stackable Redemptions | rollback-stackable-redemptions | rollback-stacked-redemptions | true | + +## 20231020 + +**Added schemas** +- Category +- CategoriesListResponseBody +- CategoriesCreateRequestBody +- CategoriesCreateResponseBody +- CategoriesGetResponseBody +- CategoriesUpdateRequestBody +- CategoriesUpdateResponseBody + +**Endpoints changes** +- `/v1/categories` + - GET + - Response schema was replaced with `CategoriesListResponseBody` (old 20_res_list_categories) + - POST + - Request parameters schema was replaced with `CategoriesCreateRequestBody` (old 20_req_create_category) + - Response schema was replaced with `CategoriesCreateResponseBody` (old 20_res_create_category) +- `/v1/categories/{categoryId}` + - GET + - Response schema was replaced with `CategoriesGetResponseBody` (old 20_obj_category_object) + - PUT + - Request parameters schema was replaced with `CategoriesUpdateRequestBody` (old 20_req_update_categories_categoryId) + - Response schema was replaced with `CategoriesUpdateResponseBody` (old 20_obj_category_object) + +## 20231019 - Promotions Stacks + +#### New schemas +- PromotionsStacksListInCampaignResponseBody +- PromotionsStacksListResponseBody +- PromotionsStacksListRequestQuery +- PromotionsStacksGetResponseBody +- PromotionsStacksUpdateRequestBody +- PromotionsStacksUpdateResponseBody +- PromotionsStacksCreateInCampaignRequestBody +- PromotionsStacksCreateInCampaignResponseBody +- PromotionStackBase +- PromotionStack + +- GET /v1/promotions/{campaignId}/stacks + - new response schema `PromotionsStacksListInCampaignResponseBody` (old `3_res_list_promotion_stacks`) +- POST /v1/promotions/{campaignId}/stacks + - new request schema `PromotionsStacksCreateInCampaignRequestBody` (old `3_req_create_promotion_stack`) + - new response schema `PromotionsStacksCreateInCampaignResponseBody` (old `3_obj_promotion_stack_object`) +- GET /v1/promotions/{campaignId}/stacks/{stackId} + - new response schema `PromotionsStacksGetResponseBody` (old `3_obj_promotion_stack_object`) +- PUT /v1/promotions/{campaignId}/stacks/{stackId} + - new request schema `PromotionsStacksUpdateRequestBody` (old `3_req_create_promotion_stack`) + - new response schema `PromotionsStacksUpdateResponseBody` (old `3_obj_promotion_stack_object`) +- GET /v1/promotions/stacks + - new response schema `PromotionsStacksListResponseBody` (old `3_res_list_promotion_stacks`) + +# 20231019 - Vouchers + +- 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** + +- 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` + + +## 20231016 - Rewards + +**New models** +- reward +- reward_base +- reward_identity +- reward_response_data +- reward_parameters + +- reward_parameters_CAMPAIGN +- reward_parameters_COIN +- reward_parameters_MATERIAL +- reward_assignment +- reward_assignment_base +- reward_assignment_identity +- reward_assignment_response_data +- rewards_list_assignments_response_body +- rewards_create_assignment_request_body +- rewards_create_assignment_coin_reward_request_body +- rewards_create_assignment_main_reward_request_body +- rewards_update_assignment_request_body + +**Endpoint changes** +- Added missing method for endpoint: GET `/v1/rewards/{rewardId)}/assignments/{assignmentId}` + - Response body schema: `reward_assignment` +- GET `/v1/rewards/{rewardId}/assignments` (listAssignments) + - New response schema: `rewards_list_assignments_response_body` (old one: `4_res_list_reward_assignments`) +- POST `/v1/rewards/{rewardId}/assignments` (createAssignment) + - New request schema: `rewards_create_assignment_request_body` (old one: `4_req_create_reward_assignment`) + - New response schema: `reward_assignment` (old one: `4_obj_reward_assignment_object`) +- PUT `/v1/rewards/{rewardId}/assignments/{assignmentId}` (updateAssignment) + - New request schema: `rewards_update_assignment_request_body` (old one: `4_req_update_reward_assignment`) + - New response schema: `reward_assignment` (old one: `4_obj_reward_assignment_object`) + +## 20231016 - Loyalties + +**New models** +- reward +- reward_base +- reward_identity +- reward_response_data +- reward_parameters + +- reward_parameters_CAMPAIGN +- reward_parameters_COIN +- reward_parameters_MATERIAL +- reward_assignment +- reward_assignment_base +- reward_assignment_identity +- reward_assignment_response_data +- loyalties_list_loyalty_tier_rewards_response_body +- loyalties_loyalty_tier_reward (old one: `8_obj_loyalty_tier_reward_object`) +- + +**Endpoint changes** +- Added missing method for endpoint: GET `/v1/loyalties/{campaignId)}/rewards/{assignmentId}` + - Response body schema: `reward_assignment` +- Added missing method for endpoint: GET `/v1/loyalties/{campaignId)}/tiers/{tierId}/rewards` + - Response body schema: `loyalties_list_loyalty_tier_rewards_response_body` ## 20231012 - Product Collections @@ -445,9 +615,6 @@ Added script, located in `docs/script/` directory to quickly update order of ref /docs/orders-1 -> /docs/orders /docs/vouchers-1 -> /docs/vouchers /docs/campaigns-1 -> /docs/campaigns -/docs/checking-eligibility-for-coupons -> /docs/checking-eligibility -/reference/examine-qualification -> /reference/check-eligibility -/reference/examine-qualification-client-side -> /reference/check-eligibility-client-side /reference/vouchers-get -> /reference/get-voucher /reference/add-gift-voucher-balance -> /reference/add-remove-gift-voucher-balance /reference/import-vouchers-1 -> /reference/import-vouchers diff --git a/docs/assets/img/guides_getting_started_Quickstart_API_keys.png b/docs/assets/img/guides_getting_started_Quickstart_API_keys.png new file mode 100644 index 000000000..dd7081827 Binary files /dev/null and b/docs/assets/img/guides_getting_started_Quickstart_API_keys.png differ diff --git a/docs/assets/img/guides_getting_started_Quickstart_audit_log.png b/docs/assets/img/guides_getting_started_Quickstart_audit_log.png new file mode 100644 index 000000000..882d969a0 Binary files /dev/null and b/docs/assets/img/guides_getting_started_Quickstart_audit_log.png differ diff --git a/docs/assets/img/guides_getting_started_Quickstart_join_the_dashboard.png b/docs/assets/img/guides_getting_started_Quickstart_join_the_dashboard.png new file mode 100644 index 000000000..b4d2e7b42 Binary files /dev/null and b/docs/assets/img/guides_getting_started_Quickstart_join_the_dashboard.png differ diff --git a/docs/assets/img/guides_getting_started_Quickstart_review_logs.png b/docs/assets/img/guides_getting_started_Quickstart_review_logs.png new file mode 100644 index 000000000..28c76d946 Binary files /dev/null and b/docs/assets/img/guides_getting_started_Quickstart_review_logs.png differ diff --git a/docs/guides/building_blocks/Products.md b/docs/guides/building_blocks/Products.md index 9628d4e60..3e004dd91 100644 --- a/docs/guides/building_blocks/Products.md +++ b/docs/guides/building_blocks/Products.md @@ -23,7 +23,8 @@ Voucherify allows for launching product-specific promotions. For example, you ca Voucherify supports product → variants relationship by default. This means you can create a parent object (`product`) and attach several variants (`SKUs`). In the [product](ref:get-product) object, you can define `attributes` to distinguish several [SKUs](ref:get-sku). For example: ```json Products - { +[ + { "id": "prod_yKHc4SyG1agSww", "source_id": "internal_erp_id_1477390384", "object": "product", @@ -39,8 +40,7 @@ Voucherify supports product → variants relationship by default. This means you "total": 0, "data": [] } - } - + }, { "id":"sku_0KtP4rvwEECQ2U", "source_id":"internal_erp_sku_id_1477475922", @@ -55,6 +55,7 @@ Voucherify supports product → variants relationship by default. This means you "country": "us" } } +] ``` > 👍 Source_id diff --git a/docs/guides/getting_started/Quickstart.md b/docs/guides/getting_started/Quickstart.md index 795526996..8b0f5e415 100644 --- a/docs/guides/getting_started/Quickstart.md +++ b/docs/guides/getting_started/Quickstart.md @@ -24,26 +24,26 @@ After you create your account, you get access to the Sandbox dashboard. Sandbox Type **BLCKFRDY** in the search bar and Voucherify will **redirect** you to the voucher page, which displays the basic information about the discount it carries. Let’s redeem the code with the API. - -![Voucherify Dashboard](https://files.readme.io/fcb7572-voucher_dashboard.png "Voucher Dashboard") + +![Voucherify Dashboard](https://files.readme.io/d7297c6-guides_getting_started_Quickstart_join_the_dashboard.png) ## Get your API keys The Sandbox Project Dashboard is already showing your default API keys for the Sandbox project. You can also navigate to Project Settings to find the Authentication section. - -![Application Keys](https://files.readme.io/9003954-application-keys.png "Application Keys") + +![Application Keys](https://files.readme.io/994df01-guides_getting_started_Quickstart_API_keys.png) ## Make a test API request -Within the Sandbox, you get 100 API calls per hour. Visit [Limits](doc:limits) to learn how to monitor your usage. With the first API request, we’ll [redeem](doc:redeem-voucher) our coupon. This function is essential to Voucherify workflow as it takes care of: +Within the Sandbox, you get 100 API calls per hour. Visit [Limits](doc:limits) to learn how to monitor your usage. With the first API request, we’ll [redeem](doc:redemption) our coupon. This function is essential to Voucherify workflow as it takes care of: 1. Checking if the code is recognizable with your account. 2. Validating if it satisfies the business rules. 3. Calculating and returning the discount value. 4. Marking the code as used. -**Note:** while calling the [redemption endpoint](ref:redeem-voucher) is enough to satisfy a basic promo code flow, it's useful to add [validation](ref:validate-voucher) to the flow every time the promo code or cart changes. Validation performs 1-3 points, but it doesn't mark the code as used. +**Note:** while calling the [redemption endpoint](ref:redeem-stacked-discounts) is enough to satisfy a basic promo code flow, it's useful to add [validation](ref:validate-stacked-discounts) to the flow every time the promo code or cart changes. Validation performs 1-3 points, but it doesn't mark the code as used. **Note:** Voucherify API supports the redemption of a single promo code and [Stackable discounts API](doc:manage-stackable-discounts), which lets you redeem up to 5 incentives per call. Before integrating Voucherify, choose which redemption endpoint you prefer to use. @@ -58,7 +58,7 @@ curl -X POST \ -H "X-App-Id: ID" \ -H "X-App-Token: SECRET KEY" \ -H "Content-Type: application/json" \ --d '{"order": {"amount": 20000} }' "https://api.voucherify.io/v1/vouchers/BLCKFRDY/redemption" +-d '{"order": {"amount": 12000} }' "https://api.voucherify.io/v1/vouchers/BLCKFRDY/redemption" ``` ```javascript JavaScript const { VoucherifyServerSide } = require('@voucherify/sdk') @@ -69,112 +69,176 @@ const client = VoucherifyServerSide({ // apiUrl: 'https://.api.voucherify.io' }) -client.redemptions.redeem("BLCKFRDY", {"order" : {"amount": 20000}}).then(console.log) +client.redemptions.redeem("BLCKFRDY", {"order" : {"amount": 12000}}).then(console.log) ``` Voucherify should reply with the [redemption](ref:get-redemption) details as in the screenshot below. If Voucherify doesn’t reply with a 20x status, check the [error code](ref:errors) to find the reason. ```json 200 OK { - "id": "r_1utfsnmdnq9KMh4xEKjcZT3m", - "object": "redemption", - "date": "2022-02-16T07:39:21.575Z", - "customer_id": null, - "tracking_id": null, - "metadata": null, - "result": "SUCCESS", + "redemptions": [ + { + "id": "r_0dafc21888c79c80bf", + "customer_id": "cust_ANjd4MFsUPXDoHeoCQXmqgCJ", + "tracking_id": "track_9xvOJH7gshn2dlEaRSUyeQ==", + "date": "2023-10-16T10:47:11.651Z", + "order": { + "id": "ord_OdtFaTU2aw6fNCzy6XvXYs51", + "source_id": null, + "status": "PAID", + "customer_id": "cust_ANjd4MFsUPXDoHeoCQXmqgCJ", + "referrer_id": null, + "amount": 12000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "total_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "total_amount": 11000, + "items": [ + { + "object": "order_item", + "source_id": "t-shirt_white", + "related_object": "product", + "quantity": 1, + "amount": 2500, + "price": 2500 + }, + { + "object": "order_item", + "source_id": "t-shirt_red", + "related_object": "product", + "quantity": 2, + "amount": 3000, + "price": 1500 + }, + { + "object": "order_item", + "source_id": "jeans_blue", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500 + } + ], + "metadata": {}, + "object": "order" + }, + "customer": { + "id": "cust_ANjd4MFsUPXDoHeoCQXmqgCJ", + "name": "Jack Jack", + "email": "maciej.krzak+Jack@voucherify.io", + "source_id": "16102023", + "metadata": { + "metadata_key": "metadata_value", + "customer_location": "geo:37.786971,-122.399677" + }, + "object": "customer" + }, + "result": "SUCCESS", + "voucher": { + "id": "v_hvY4FNDjL1LYpKDvAtc4I7uXT9DouOv8", + "code": "BLCKFRDY", + "discount": { + "type": "AMOUNT", + "amount_off": 1000 + }, + "type": "DISCOUNT_VOUCHER", + "campaign": null, + "campaign_id": null, + "is_referral_code": false, + "holder_id": "cust_iXUTMbFO3QdLFHH8WLKBLyA1", + "created_at": "2023-03-01T10:28:04.759Z", + "object": "voucher" + }, + "object": "redemption" + } + ], "order": { - "id": "ord_0r32g8iQNp0WA84fBK814RgG", + "id": "ord_OdtFaTU2aw6fNCzy6XvXYs51", "source_id": null, - "created_at": "2022-02-16T07:39:21.546Z", + "created_at": "2023-10-16T10:47:11.616Z", "updated_at": null, "status": "PAID", - "amount": 20000, + "amount": 12000, "discount_amount": 1000, "total_discount_amount": 1000, - "total_amount": 19000, + "total_amount": 11000, "applied_discount_amount": 1000, "total_applied_discount_amount": 1000, - "customer_id": null, + "items": [ + { + "object": "order_item", + "source_id": "t-shirt_white", + "related_object": "product", + "quantity": 1, + "amount": 2500, + "price": 2500, + "subtotal_amount": 2500, + "product": { + "metadata": { + "color": "white", + "any_key": "any_value", + "category": "t-shirt", + "condition": "NEW", + "manufacturing_date_time": "2021-08-13T08:00:00.000Z" + } + } + }, + { + "object": "order_item", + "source_id": "t-shirt_red", + "related_object": "product", + "quantity": 2, + "amount": 3000, + "price": 1500, + "subtotal_amount": 3000, + "product": { + "metadata": { + "color": "red", + "any_key": "any_value", + "category": "t-shirt", + "condition": "NEW", + "manufacturing_date_time": "2021-08-13T08:00:00.000Z" + } + } + }, + { + "object": "order_item", + "source_id": "jeans_blue", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500, + "product": { + "metadata": { + "color": "blue", + "any_key": "any_value", + "category": "jeans", + "condition": "NEW", + "manufacturing_date_time": "2021-08-13T08:00:00.000Z" + } + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_ANjd4MFsUPXDoHeoCQXmqgCJ", + "object": "customer" + }, + "customer_id": "cust_ANjd4MFsUPXDoHeoCQXmqgCJ", "referrer_id": null, "object": "order", "redemptions": { - "r_1utfsnmdnq9KMh4xEKjcZT3m": { - "date": "2022-02-16T07:39:21.575Z", + "r_0dafc21888c79c80bf": { + "date": "2023-10-16T10:47:11.651Z", "related_object_type": "voucher", - "related_object_id": "v_MMn7nc75rwUjdPnfl4X6NtCAK5MDNgNk" + "related_object_id": "v_hvY4FNDjL1LYpKDvAtc4I7uXT9DouOv8" } } }, - "customer": null, - "related_object_type": "voucher", - "related_object_id": "v_MMn7nc75rwUjdPnfl4X6NtCAK5MDNgNk", - "voucher": { - "id": "v_MMn7nc75rwUjdPnfl4X6NtCAK5MDNgNk", - "code": "BLCKFRDY", - "campaign": null, - "campaign_id": null, - "category": "showcase", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 1000 - }, - "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": { - "name": "Black Friday Coupon" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1/FEz2OO26+KPxsV7dn/EFfzLbdGNArC+25Y8CX1j+beNmaxFcbOTVHnHHvmHzc50VdE+D0Cimz+7ZMJC92PSvshoCDBEnu5T10TOKozvVTaZn5O1NfaR5q+3zDnWRoFhfCcg/TilTQng==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FFEz2OO26%2BKPxsV7dn%2FEFfzLbdGNArC%2B25Y8CX1j%2BbeNmaxFcbOTVHnHHvmHzc50VdE%2BD0Cimz%2B7ZMJC92PSvshoCDBEnu5T10TOKozvVTaZn5O1NfaR5q%2B3zDnWRoFhfCcg%2FTilTQng%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+Pgk0VxfAp5EbUgyoJxdy9Dcnnt4YYF64Kdk4o3GXzc3NeOvi6wFL27I2/j8bbMm8xZxETc6C0xgV9DcDUarJhpYjA4k+EhSu0dvoqrkSuGo1Pk+yFAeu7dieakoIR2xv+5B2ebqXstQ==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BPgk0VxfAp5EbUgyoJxdy9Dcnnt4YYF64Kdk4o3GXzc3NeOvi6wFL27I2%2Fj8bbMm8xZxETc6C0xgV9DcDUarJhpYjA4k%2BEhSu0dvoqrkSuGo1Pk%2ByFAeu7dieakoIR2xv%2B5B2ebqXstQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-16T06:58:29.207Z", - "updated_at": "2022-02-16T07:39:21.576Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "object": "list", - "url": "/v1/vouchers/BLCKFRDY/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/BLCKFRDY/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" - } - } + "inapplicable_redeemables": [], + "skipped_redeemables": [] } ``` @@ -184,15 +248,14 @@ Because BLCKFRDY doesn’t have any redemption limits, you can use it multiple t Every redemption can be [listed](ref:list-redemptions) with the API or in the dashboard. When you go to the voucher view, in “Recent changes”, you’ll see operations performed on the object. You can switch to the REDEMPTIONS HISTORY tab to track all redemptions. - + [block:image] { "images": [ { "image": [ - "https://files.readme.io/8bc30bc-recent_changes.png", - "recent_changes.png", + "https://files.readme.io/95e3dba-guides_getting_started_Quickstart_review_logs.png", 1004 ], "sizing": "80" @@ -203,8 +266,8 @@ Every redemption can be [listed](ref:list-redemptions) with the API or in the da To monitor and filter the list of all API calls for your project, you can go to the [Audit log](https://app.voucherify.io/#/app/core/logs): - -![Audit Log](https://files.readme.io/1a4682c-audit_log.png "Audit Log") + +![Audit Log](https://files.readme.io/207c12c-guides_getting_started_Quickstart_audit_log.png) ## Test promo scenarios with "Hot Beans" demo store diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index aad809190..76c0acee2 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.

| -## 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
`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 747fe1737..70f2bd04c 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
`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 30b3ff6b7..16286956c 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
`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 64c763d7b..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 @@ -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
`string` |

The type of object represented by the ID.

Available values: `validation_rules_assignment` | [block:html] { 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/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/package-lock.json b/package-lock.json index b987351eb..fde0aac8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "": { "version": "1.0.0", "dependencies": { + "axios": "^1.5.1", "colors": "^1.4.0", "dotenv": "^16.3.1", "markdown-it": "^13.0.2", @@ -106,6 +107,21 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", + "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -114,11 +130,30 @@ "node": ">=0.1.90" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -149,6 +184,38 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/follow-redirects": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", + "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/linkify-it": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", @@ -182,6 +249,25 @@ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==" }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/minimist": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", @@ -214,6 +300,11 @@ "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/tiny-case": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tiny-case/-/tiny-case-1.0.3.tgz", diff --git a/package.json b/package.json index 077d58609..713cacc35 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,11 @@ "build-md-tables-from-openapi": "ts-node ./scripts/build-md-tables-from-openapi.ts", "readme-fix-reference-docs": "ts-node ./scripts/readme-fix-reference-docs.ts", "remove-stoplight-tags-from-openapi": "ts-node ./scripts/remove-stoplight-tags-from-openapi.ts", - "manage-project": "ts-node ./scripts/manage-project.ts" + "manage-project": "ts-node ./scripts/manage-project.ts", + "readme-upload-missing-images": "ts-node ./scripts/readme-upload-missing-images.ts" }, "dependencies": { + "axios": "^1.5.1", "colors": "^1.4.0", "dotenv": "^16.3.1", "markdown-it": "^13.0.2", diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index dae42e817..0f726a183 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -193,42 +193,6 @@ "description": "A **code** that identifies the voucher.", "required": true }, - "X-App-Id": { - "name": "X-App-Id", - "in": "header", - "required": true, - "schema": { - "type": "string" - }, - "description": "Application ID" - }, - "X-App-Token": { - "name": "X-App-Token", - "in": "header", - "required": true, - "schema": { - "type": "string" - }, - "description": "Application Secret Key" - }, - "X-Client-Token": { - "name": "X-Client-Token", - "in": "header", - "required": true, - "schema": { - "type": "string" - }, - "description": "Application Secret Key" - }, - "X-Client-Application-Id": { - "name": "X-Client-Application-Id", - "in": "header", - "required": true, - "schema": { - "type": "string" - }, - "description": "Application ID" - }, "audienceRulesOnly": { "name": "audienceRulesOnly", "in": "query", @@ -361,17 +325,6 @@ "style": "deepObject", "explode": true }, - "filters": { - "name": "filters", - "in": "query", - "required": false, - "schema": { - "anyOf": [] - }, - "description": "A filter.", - "style": "deepObject", - "explode": true - }, "campaign_type": { "name": "campaign_type", "in": "query", @@ -399,70 +352,6 @@ }, "description": "Indicates the origin (scheme, hostname, and port)." }, - "session2": { - "name": "session", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_session_lock_discount_code" - }, - { - "$ref": "#/components/schemas/6_req_session_lock_gift_card" - }, - { - "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" - } - ] - }, - "style": "deepObject", - "explode": true, - "description": "The session object required to establish a session between multiple parallel validation and redemption requests." - }, - "session": { - "name": "session", - "in": "query", - "required": false, - "schema": { - "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 addtionally the redemption **gift credits** specified within the request for a gift card and the **loyalty points** for a loyalty card.", - "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." - } - } - }, - "style": "deepObject", - "explode": true, - "description": "The session object required to establish a session between multiple parallel validation and redemption requests." - }, "metadata": { "name": "metadata", "in": "query", @@ -3543,258 +3432,227 @@ } } }, - "1_obj_voucher_object_discount_shipping_PUT": { - "title": "Shipping", - "description": "Update shipping discount type.", + "1_obj_vouchers_import_discount_amount": { + "title": "Import amount discount type", "type": "object", + "description": "Import amount discount type.", "properties": { "type": { "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." - }, - "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" - }, - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" - } - } - }, - "1_obj_vouchers_import_discount_amount": { - "title": "Import amount discount type", - "type": "object", - "description": "Import amount discount type.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Applies an amount type discount. **Requires** child attribute\n `type`=`AMOUNT` when importing this discount." - }, - "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. In case of the amount being calculated by the formula, i.e. the `amount_off_formula` parameter is present in the 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 amount off." - }, - "amount_off_formula": { - "type": "string", - "description": "Formula used to calculate the 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" - } - }, - "required": [ - "type", - "amount_off", - "effect" - ] - }, - "1_obj_vouchers_import_discount_percentage": { - "title": "Import percentage discount type", - "type": "object", - "description": "Import percentage discount type.", - "properties": { - "type": { - "type": "string", - "description": "Applies a percentage discount. Requires child attribute `type`=`PERCENT` when importing this discount.", - "default": "PERCENT" - }, - "percent_off": { - "type": "integer", - "example": 10, - "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the `percent_off_formula` parameter is present in the percent 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 percent off.", - "minimum": 0, - "maximum": 100 - }, - "percent_off_formula": { - "type": "string", - "description": "Formula used to calculate the discount." - }, - "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." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." - } - }, - "required": [ - "type", - "percent_off", - "effect" - ] - }, - "1_obj_vouchers_import_discount_fixed": { - "title": "Import fixed discount type", - "type": "object", - "description": "Import fixed discount type.", - "properties": { - "type": { - "type": "string", - "default": "FIXED", - "description": "Sets a fixed total on cart or item(s) and then calculates the discount to apply. **Requires** child attribute\n `type`=`FIXED` when importing this discount." - }, - "fixed_amount": { - "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.", - "example": 1000, - "type": "integer" - }, - "fixed_amount_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item or a new order total." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "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. |\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. |" - } - }, - "required": [ - "type", - "fixed_amount", - "effect" - ] - }, - "1_obj_vouchers_import_discount_unit_one": { - "title": "Import unit discount type, single item", - "type": "object", - "description": "Define single item type.", - "properties": { - "type": { - "type": "string", - "description": "Applies a full value discount to item(s). **Requires** child attribute `type`=`UNIT` when importing this discount.", - "default": "UNIT" - }, - "unit_off": { - "type": "number", - "format": "float", - "description": "Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the `unit_off_formula` parameter is present in the unit 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 unit value.", - "example": 1 - }, - "unit_off_formula": { - "type": "string", - "description": "Formula used to calculate the discount." - }, - "unit_type": { - "type": "string", - "description": "The product deemed as free, chosen from the product inventory (e.g. time, items).", - "example": "prod_f1r5Tpr0DuC7" - }, - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" - } - }, - "required": [ - "type", - "unit_off", - "unit_type", - "effect" - ] - }, - "1_obj_vouchers_import_discount_unit_multiple": { - "title": "Import unit discount type, multiple items", - "type": "object", - "description": "Define 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": { - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the `unit_off_formula` parameter is present in the unit 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 unit value.", - "example": 1 - }, - "unit_off_formula": { - "type": "string", - "description": "Formula used to calculate the discount." - }, - "unit_type": { - "type": "string", - "description": "The product deemed as free, chosen from the product inventory (e.g. time, items).", - "example": "prod_f1r5Tpr0DuC7" - }, - "effect": { - "type": "string", - "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - } - }, - "required": [ - "unit_off", - "unit_type", - "effect" - ] - } - } - }, - "required": [ - "type", - "effect", - "units" - ] - }, - "1_obj_vouchers_import_discount_shipping": { - "title": "Import shipping discount type", - "description": "Import shipping discount type.", - "type": "object", - "properties": { - "type": { - "type": "string", - "description": "Applies a full value discount to item(s).", - "default": "UNIT" + "default": "AMOUNT", + "description": "Applies an amount type discount. **Requires** child attribute\n `type`=`AMOUNT` when importing this discount." + }, + "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. In case of the amount being calculated by the formula, i.e. the `amount_off_formula` parameter is present in the 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 amount off." + }, + "amount_off_formula": { + "type": "string", + "description": "Formula used to calculate the 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" + } + }, + "required": [ + "type", + "amount_off", + "effect" + ] + }, + "1_obj_vouchers_import_discount_percentage": { + "title": "Import percentage discount type", + "type": "object", + "description": "Import percentage discount type.", + "properties": { + "type": { + "type": "string", + "description": "Applies a percentage discount. Requires child attribute `type`=`PERCENT` when importing this discount.", + "default": "PERCENT" + }, + "percent_off": { + "type": "integer", + "example": 10, + "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the `percent_off_formula` parameter is present in the percent 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 percent off.", + "minimum": 0, + "maximum": 100 + }, + "percent_off_formula": { + "type": "string", + "description": "Formula used to calculate the discount." + }, + "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." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + } + }, + "required": [ + "type", + "percent_off", + "effect" + ] + }, + "1_obj_vouchers_import_discount_fixed": { + "title": "Import fixed discount type", + "type": "object", + "description": "Import fixed discount type.", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Sets a fixed total on cart or item(s) and then calculates the discount to apply. **Requires** child attribute\n `type`=`FIXED` when importing this discount." + }, + "fixed_amount": { + "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.", + "example": 1000, + "type": "integer" + }, + "fixed_amount_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item or a new order total." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "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. |\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. |" + } + }, + "required": [ + "type", + "fixed_amount", + "effect" + ] + }, + "1_obj_vouchers_import_discount_unit_one": { + "title": "Import unit discount type, single item", + "type": "object", + "description": "Define single item type.", + "properties": { + "type": { + "type": "string", + "description": "Applies a full value discount to item(s). **Requires** child attribute `type`=`UNIT` when importing this discount.", + "default": "UNIT" + }, + "unit_off": { + "type": "number", + "format": "float", + "description": "Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the `unit_off_formula` parameter is present in the unit 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 unit value.", + "example": 1 + }, + "unit_off_formula": { + "type": "string", + "description": "Formula used to calculate the discount." + }, + "unit_type": { + "type": "string", + "description": "The product deemed as free, chosen from the product inventory (e.g. time, items).", + "example": "prod_f1r5Tpr0DuC7" + }, + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" + } + }, + "required": [ + "type", + "unit_off", + "unit_type", + "effect" + ] + }, + "1_obj_vouchers_import_discount_unit_multiple": { + "title": "Import unit discount type, multiple items", + "type": "object", + "description": "Define 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": { + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the `unit_off_formula` parameter is present in the unit 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 unit value.", + "example": 1 + }, + "unit_off_formula": { + "type": "string", + "description": "Formula used to calculate the discount." + }, + "unit_type": { + "type": "string", + "description": "The product deemed as free, chosen from the product inventory (e.g. time, items).", + "example": "prod_f1r5Tpr0DuC7" + }, + "effect": { + "type": "string", + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + } + }, + "required": [ + "unit_off", + "unit_type", + "effect" + ] + } + } + }, + "required": [ + "type", + "effect", + "units" + ] + }, + "1_obj_vouchers_import_discount_shipping": { + "title": "Import shipping discount type", + "description": "Import shipping discount type.", + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Applies a full value discount to item(s).", + "default": "UNIT" }, "unit_off": { "type": "number", @@ -3890,8 +3748,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": { @@ -3907,38 +3765,108 @@ }, "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_gift_card_transaction_object" - } + "$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" + ] }, - "1_obj_gift_card_transaction_object": { - "title": "Gift Card Transaction Object", - "description": "Gift card transaction object", + "voucher_transaction": { + "title": "Voucher Transaction Object", + "description": "List of voucher transactions", "anyOf": [ { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_redemption" - }, - { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_refund" - }, - { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_addition" + "$ref": "#/components/schemas/gift_card_transaction" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_removal" + "$ref": "#/components/schemas/LoyaltyCardTransaction" } ] }, - "1_obj_gift_card_transaction_object_redemption": { - "title": "Redemption", - "description": "When credits are used to pay for an order.", + "gift_card_transaction": { + "title": "Gift Card Transaction", + "description": "List of gift card transactions", + "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", "properties": { "id": { @@ -3947,31 +3875,85 @@ "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", "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": { + "reason": { + "type": [ + "string", + "null" + ], + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + }, + "related_transaction_id": { + "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_created": { + "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_redemption_details": { + "title": "Redemption", + "description": "When credits are used to pay for an order.", + "type": "object", + "properties": { + "source": { "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" ] }, - "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.", @@ -3983,15 +3965,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", @@ -4002,9 +3999,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", @@ -4013,6 +4012,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", @@ -4020,9 +4023,11 @@ "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, "type": { - "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } } @@ -4031,6 +4036,10 @@ "order": { "type": "object", "description": "Contains information about the original order.", + "required": [ + "id", + "source_id" + ], "properties": { "id": { "type": "string", @@ -4038,7 +4047,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." } } @@ -4046,6 +4058,9 @@ "redemption": { "type": "object", "description": "Contains information about the original redemption.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4055,54 +4070,25 @@ } } } - }, - "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." } - } + }, + "required": [ + "source", + "type", + "details" + ] }, - "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", "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": [ + "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", @@ -4115,15 +4101,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", @@ -4134,9 +4136,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", @@ -4145,6 +4149,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", @@ -4154,7 +4162,10 @@ "type": { "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } } @@ -4163,6 +4174,10 @@ "order": { "type": "object", "description": "Contains information about the original order.", + "required": [ + "id", + "source_id" + ], "properties": { "id": { "type": "string", @@ -4170,7 +4185,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." } } @@ -4178,6 +4196,9 @@ "redemption": { "type": "object", "description": "Contains information about the original redemption.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4189,6 +4210,9 @@ "rollback": { "type": "object", "description": "Contains information about the redemption rollback.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4198,43 +4222,19 @@ } } } - }, - "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." } - } + }, + "required": [ + "source", + "type", + "details" + ] }, - "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", "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.", @@ -4243,10 +4243,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4258,15 +4254,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", @@ -4277,9 +4287,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", @@ -4288,6 +4300,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", @@ -4295,52 +4311,36 @@ "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" + ] } } } } - }, - "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." } - } + }, + "required": [ + "source", + "type", + "details" + ] }, - "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", "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.", @@ -4349,10 +4349,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4364,15 +4360,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", @@ -4383,9 +4393,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", @@ -4394,6 +4406,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", @@ -4401,41 +4417,44 @@ "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" + ] } } } } - }, - "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." } - } + }, + "required": [ + "source", + "type", + "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_parameters", "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.", + "voucher_transactions_export_parameters": { + "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": { @@ -4450,31 +4469,19 @@ "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. |", + "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" } } } }, - "1_obj_export_transactions_object": { - "title": "Export Object", + "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", @@ -4482,9 +4489,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", @@ -4496,10 +4505,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": { @@ -4508,16 +4514,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" + "$ref": "#/components/schemas/voucher_transactions_filters" }, "result": { - "type": "object", + "type": [ + "object", + "null" + ], "description": "Contains the URL of the CSV file.", + "required": [ + "url" + ], "properties": { "url": { "type": "string", @@ -4526,11 +4540,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", @@ -4697,19 +4725,6 @@ "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", @@ -5138,96 +5153,6 @@ "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", @@ -5313,1537 +5238,6 @@ } } }, - "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`." - } - } - }, - "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)." - } - } - }, - "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 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." - }, - "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." - } - } - }, - "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" - ] - }, - "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." - } - } - }, - "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.", @@ -9068,7 +7462,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", @@ -9589,7 +7983,11 @@ "description": "Campaign type.", "default": "DISCOUNT_COUPONS" } - } + }, + "required": [ + "id", + "type" + ] }, "4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS": { "title": "Gift Vouchers", @@ -9610,7 +8008,12 @@ "description": "Campaign type.", "default": "GIFT_VOUCHERS" } - } + }, + "required": [ + "id", + "balance", + "type" + ] }, "4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM": { "title": "Points on loyalty card", @@ -9631,7 +8034,12 @@ "description": "Campaign type.", "default": "LOYALTY_PROGRAM" } - } + }, + "required": [ + "id", + "balance", + "type" + ] }, "4_obj_reward_object_parameters_COIN": { "title": "Pay with Points", @@ -9695,62 +8103,6 @@ } ] }, - "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", @@ -9859,53 +8211,6 @@ } ] }, - "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_update_reward_CAMPAIGN": { "title": "Digital Reward", "type": "object", @@ -10187,60 +8492,215 @@ } } }, - "4_res_list_reward_assignments": { + "reward_assignment_base": { + "title": "Reward Assignment Base", "type": "object", - "description": "Response body schema for **GET** `/rewards/{rewardID}/assignments`.", - "title": "List Reward Assignments Response Body", + "x-tags": [ + "REWARDS API" + ], "properties": { - "object": { + "related_object_id": { "type": "string", - "description": "The type of object represented by JSON. This object stores information about reward assignments in a dictionary.", - "default": "list" + "description": "Related object ID to which the reward was assigned.", + "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ" }, - "data_ref": { + "related_object_type": { + "description": "Related object type to which the reward was assigned.", + "enum": [ + "campaign" + ] + } + }, + "required": [ + "related_object_id", + "related_object_type" + ] + }, + "reward_assignment_identity": { + "title": "Reward Assignment Identity", + "type": "object", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "id": { "type": "string", - "description": "Identifies the name of the attribute that contains the array of reward assignments.", - "default": "data" + "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", + "description": "Unique reward assignment ID, assigned by Voucherify." }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } + "reward_id": { + "type": "string", + "description": "Associated reward ID.", + "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY" + } + }, + "required": [ + "id", + "reward_id" + ] + }, + "reward_assignment_response_data": { + "title": "Reward Assignment Response Data", + "type": "object", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "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" }, - "total": { - "type": "integer", - "description": "Total number of reward assignments." + "updated_at": { + "type": [ + "string", + "null" + ], + "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": { + "description": "The type of object represented by the JSON. This object stores information about the reward assignment.", + "enum": [ + "reward_assignment" + ] } - } + }, + "required": [ + "created_at", + "updated_at", + "object" + ] }, - "4_req_update_reward_assignment": { + "reward_assignment_campaign_and_material_reward_parameters": { + "title": "Reward Assignment Campaign or Material Reward Parameters", "type": "object", - "description": "Request body schema for **PUT** `/rewards/{rewardID}/assignments/{assignmentID}`.", - "title": "Update Reward Assignment Request Body", + "x-tags": [ + "REWARDS API" + ], "properties": { "parameters": { - "type": "object", "description": "Defines the cost of the reward.", + "type": "object", "properties": { "loyalty": { "type": "object", "description": "Defines the equivalent points value of the reward.", + "required": [ + "points" + ], "properties": { "points": { "type": "integer", - "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." + "description": "The number of points required to redeem the reward." } } } - } + }, + "required": [ + "loyalty" + ] } - } + }, + "required": [ + "parameters" + ] }, - "4_req_create_reward_assignment": { + "reward_assignment": { + "title": "Reward Assignment", + "oneOf": [ + { + "$ref": "#/components/schemas/reward_assignment_coin_reward" + }, + { + "$ref": "#/components/schemas/reward_assignment_campaign_and_material_reward" + } + ], + "type": "object" + }, + "reward_assignment_coin_reward": { + "title": "Reward Assignment - Coin Reward", + "allOf": [ + { + "$ref": "#/components/schemas/reward_assignment_identity" + }, + { + "$ref": "#/components/schemas/reward_assignment_base" + }, + { + "$ref": "#/components/schemas/reward_assignment_response_data" + } + ], + "type": "object" + }, + "reward_assignment_campaign_and_material_reward": { + "title": "Reward Assignment - Campaign or Material Reward", + "allOf": [ + { + "$ref": "#/components/schemas/reward_assignment_identity" + }, + { + "$ref": "#/components/schemas/reward_assignment_base" + }, + { + "$ref": "#/components/schemas/reward_assignment_response_data" + }, + { + "$ref": "#/components/schemas/reward_assignment_campaign_and_material_reward_parameters" + } + ], + "type": "object" + }, + "rewards_list_assignments_response_body": { "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/reward_assignment" + } + }, + "total": { + "type": "integer", + "description": "Total number of reward assignments." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "rewards_create_assignment_request_body": { "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", "title": "Create Reward Assignment Request Body", + "oneOf": [ + { + "$ref": "#/components/schemas/rewards_create_assignment_campaign_and_material_reward_request_body" + }, + { + "$ref": "#/components/schemas/rewards_create_assignment_coin_reward_request_body" + } + ] + }, + "rewards_create_assignment_campaign_and_material_reward_request_body": { + "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", + "title": "Reward Assignment - Campaign Or Material Reward", "properties": { "campaign": { "type": "string", @@ -10271,6 +8731,26 @@ "parameters" ] }, + "rewards_create_assignment_coin_reward_request_body": { + "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", + "title": "Reward Assignment - Coin Reward", + "type": "object", + "properties": { + "campaign": { + "type": "string", + "description": "The campaign ID of the campaign to which the reward is to be assigned." + }, + "validation_rules": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "campaign" + ] + }, "5_obj_publication_object": { "title": "Publication Object", "type": "object", @@ -10977,30 +9457,6 @@ } } }, - "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`.", @@ -11040,12 +9496,6 @@ } } }, - "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.", @@ -11280,16 +9730,6 @@ } } }, - "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", @@ -14232,2336 +12672,1141 @@ "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": [ - "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." - } - }, - "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." - } - }, - "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." - } - } - }, - "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." - }, + "properties": { "id": { "type": "string", - "description": "Redeemable ID, i.e. the promotion tier ID." + "description": "Unique loyalty card code." }, "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" + "description": "Type of object, i.e. `voucher`.", + "default": "voucher" }, - "metadata": { + "reward": { "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 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_res_validations_redeemables_promotion_stack": { + "19_req_redeemables_discount_referral_promotion_tier_promotion_stack": { + "title": "Discount code, referral code, promotion tier, promotion stack", "type": "object", - "description": "Response schema model for validating a promotion stack.", - "title": "Promotion Stack", + "description": "Redeem a discount code, referral code, promotion tier, or promotion stack.", "properties": { - "status": { + "object": { "type": "string", + "description": "Redeemable object type.", "enum": [ - "APPLICABLE" + "voucher", + "promotion_tier", + "promotion_stack" ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + "default": "voucher" }, "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" + "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_res_validations-true": { + "19_req_redemptions": { + "title": "Redeem Stackable Discounts Request Body", "type": "object", - "title": "True", - "description": "Response body schema for POST `/validations`.", + "description": "This data model represents the request body for redeeming multiple incentives.", "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 + "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", - "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", + "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_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_req_redeemables_discount_referral_promotion_tier_promotion_stack" }, { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" + "$ref": "#/components/schemas/19_req_redeemables_gift_card" }, { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" + "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" } ] } }, - "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_req_session_lock" + }, + "customer": { + "anyOf": [ { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" }, { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" - }, + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" }, { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_shipping" + "$ref": "#/components/schemas/10_req_create_order" } - ] - } - } - }, - "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. |" + "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)." }, - "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 - ] + "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_obj_voucher_object_discount_unit_one": { - "title": "Unit, single item", + "19_req_validations": { + "title": "Validate Stackable Discounts Request Body", "type": "object", - "description": "Single item type.", + "description": "This data model represents the request body for the `/validations` endpoint.", "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." + "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" + ] + } + } + } }, - "unit_off": { - "type": "number", - "description": "Number of units to be granted a full value discount. ", - "example": 1, - "format": "float" + "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" + } + ] + } }, - "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" + "session": { + "$ref": "#/components/schemas/19_req_session_lock" }, - "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." + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, - "source_id": { - "type": "string", - "description": "SKU source ID." + { + "$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." }, - "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." + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, - "source_id": { - "type": "string", - "description": "Product source ID." + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" }, - "name": { - "type": "string", - "description": "Product name." + { + "$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" }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula.", - "enum": [ - false, - true - ] + { + "$ref": "#/components/schemas/19_res_validations-false" } - } + ] }, - "19_obj_voucher_object_discount_unit_multiple": { - "title": "Unit, multiple items", + "19_res_validations-false": { "type": "object", - "description": "Multiple item types.", + "title": "False", + "description": "Response body schema for POST `/validations`.", "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." + "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 }, - "units": { + "redeemables": { "type": "array", - "description": "Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", "items": { "type": "object", - "description": "Object defining a unit discount.", "properties": { - "effect": { + "status": { "type": "string", "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" + "APPLICABLE", + "INAPPLICABLE", + "SKIPPED" ], - "description": "Defines how the unit is added to the customer's order." + "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." }, - "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 + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the voucher code." }, - "unit_type": { + "object": { "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" + "description": "Redeemable's object type.", + "enum": [ + "voucher", + "promotion_tier", + "promotion_stack" + ] }, - "sku": { + "result": { "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", + "description": "Provides details for an inapplicable redeemable.", "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." + "error": { + "$ref": "#/components/schemas/e_error" } } }, - "product": { + "metadata": { "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." - } - } + "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" } } } }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula." + "tracking_id": { + "type": "string", + "example": "track_VAVo1/z+G2GI2LPw==", + "description": "Hashed customer source ID." } } }, - "19_obj_voucher_object_discount_shipping": { - "title": "Shipping", - "description": "Shipping discount type.", + "19_res_validations_redeemables_discount_voucher": { "type": "object", + "description": "Response schema model for validating a discount code.", + "title": "Discount Voucher", "properties": { - "type": { + "status": { "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." }, - "effect": { + "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 + "description": "Redeemable ID, i.e. the voucher code." }, - "unit_type": { + "object": { "type": "string", - "description": "The shipping product deemed as free.", - "default": "prod_5h1pp1ng" + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] }, - "product": { + "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": "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" - } - } + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of shipping items is based on a formula.", - "default": false, - "enum": [ - false - ] + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" } } }, - "19_obj_validations-true_result_gift_card": { + "19_res_validations_redeemables_gift_card": { "type": "object", + "description": "Response schema model for validating a gift card.", "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.", + "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", - "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)." - } - } + "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_obj_validations-true_result_loyalty_card": { + "19_res_validations_redeemables_loyalty_card": { "type": "object", + "description": "Response schema model for validating a loyalty card.", "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" - } + "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" ] - } - } - }, - "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.", + }, + "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", - "properties": { - "points": { - "type": "integer", - "description": "Total number of loyalty points to be applied in the redemption." - } - } + "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_obj_order_object_validation_res": { + "19_res_validations_redeemables_promotion_tier": { "type": "object", - "title": "Order", - "description": "Contains the combined effect of all redeemables taken into account on the order object properties.", + "description": "Response schema model for validating a promotion tier.", + "title": "Promotion Tier", "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" + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion tier ID." }, - "applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_tier" + ] }, - "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)`" + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" }, - "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`" + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" }, - "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." - } - } - } - } - } + "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 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": "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" } } }, - "19_obj_order_object_validation_res_per_redeemable": { + "19_res_validations_redeemables_promotion_stack": { "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.", + "description": "Response schema model for validating a promotion stack.", + "title": "Promotion Stack", "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" + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion stack ID." }, - "applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_stack" + ] }, - "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)`" + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" }, - "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`" + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" }, - "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." - } - } - } - } - } + "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 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": "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" } } }, - "19_res_redemptions_parentRedemptionId_rollbacks": { + "19_res_validations-true": { "type": "object", + "title": "True", + "description": "Response body schema for POST `/validations`.", "properties": { - "rollbacks": { + "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": "Contains the rollback redemption objects of the particular incentives.", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", "items": { "anyOf": [ { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_discount_voucher_stacked" + "$ref": "#/components/schemas/19_res_validations_redeemables_discount_voucher" }, { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_loyalty_card_stacked" + "$ref": "#/components/schemas/19_res_validations_redeemables_gift_card" }, { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_gift_card_stacked" + "$ref": "#/components/schemas/19_res_validations_redeemables_loyalty_card" }, { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_promotion_tier_stacked" + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" + }, + { + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" } ] } }, - "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" - } - }, - "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." + "$ref": "#/components/schemas/19_obj_order_object_validation_res" }, "tracking_id": { "type": "string", - "example": "track_fxEMFiLowFHg==", + "example": "track_VAVo1/z+G2GI2LPw==", "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": [ + "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_order_object_rollback_stacked_per_redemption_apply_to_order" + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount" }, { - "$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." + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount_dynamic" }, - "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" + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage" }, - "code": { - "type": "string", - "description": "Unique voucher code." + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" }, - "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" - } - ] + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "DISCOUNT_VOUCHER" - ] + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." + { + "$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." }, - "redemption": { + "effect": { "type": "string", - "description": "Unique redemption ID of the original redemption." + "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_redemption_rollback_object_loyalty_card_stacked": { + "19_obj_voucher_object_discount_amount_dynamic": { + "title": "Dynamic Amount", "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", + "description": "Amount discount type based on a formula.", "properties": { - "id": { + "type": { "type": "string", - "example": "rr_0c5eaf4060133bf784", - "description": "Unique redemption rollback ID." + "default": "AMOUNT", + "description": "Applies an amount discount." }, - "customer_id": { + "effect": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "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." }, - "tracking_id": { + "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", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." + "default": "PERCENT", + "description": "Applies a percentage discount." }, - "date": { + "effect": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." }, - "amount": { + "percent_off": { "type": "integer", - "description": "Number of points being returned to the loyalty card." + "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 }, - "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" - } - ] + "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." }, - "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" - } + "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." }, - "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": { + "effect": { "type": "string", "enum": [ - "SUCCESS", - "FAILURE" + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" ], - "description": "Redemption rollback result." + "description": "Defines how the discount is applied to the customer's order." }, - "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" - } - } + "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." }, - "redemption": { + "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", - "description": "Unique redemption ID of the original redemption." + "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_redemption_rollback_object_gift_card_stacked": { + "19_obj_voucher_object_discount_fixed_items": { + "title": "New Prices for Items", + "description": "Fixed discount type for item(s).", "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", "properties": { - "id": { + "type": { "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." + "default": "FIXED", + "description": "Sets a new item price and then calculates the discount to apply." }, - "customer_id": { + "effect": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "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. |" }, - "tracking_id": { + "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", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." + "default": "UNIT", + "description": "Applies a full value discount to item(s)." }, - "date": { + "effect": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "default": "ADD_MISSING_ITEMS", + "description": "Defines how the unit is added to the customer's order." }, - "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)." + "unit_off": { + "type": "number", + "description": "Number of units to be granted a full value discount. ", + "example": 1, + "format": "float" }, - "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" - } - ] + "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" }, - "customer": { + "sku": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Defines the product details of the product or the parent product in case of an SKU.", "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." + "example": "sku_0a3efc90375d1217e2", + "description": "Unique SKU ID 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." - }, - "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." + "description": "SKU source ID." }, - "object": { + "sku": { "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "description": "SKU name." } } }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { + "product": { "type": "object", - "description": "Defines the details of the voucher.", + "description": "Defines the product details of the product or the parent product in case of an SKU.", "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" - ] + "example": "prod_0bc3bd76a61082e6b3", + "description": "Unique (parent) product ID assigned by Voucherify." }, - "campaign": { + "source_id": { "type": "string", - "description": "Voucher's parent campaign name." + "description": "Product source ID." }, - "campaign_id": { + "name": { "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": "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", + "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." + } + } + } } } }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0c5bf3323008a35032" + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of items is based on a formula." } } }, - "19_obj_redemption_rollback_object_promotion_tier_stacked": { + "19_obj_voucher_object_discount_shipping": { + "title": "Shipping", + "description": "Shipping discount type.", "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", "properties": { - "id": { + "type": { "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." + "default": "UNIT", + "description": "Applies a full value discount to item(s)." }, - "customer_id": { + "effect": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." + "unit_off": { + "type": "number", + "format": "float", + "description": "Subtracts 1 shipping item from the subtotal.", + "default": 1 }, - "date": { + "unit_type": { "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" - } - ] + "description": "The shipping product deemed as free.", + "default": "prod_5h1pp1ng" }, - "customer": { + "product": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the product details of the shipping product.", "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." + "example": "prod_5h1pp1ng", + "description": "Unique product ID assigned by Voucherify, i.e. `prod_5h1pp1ng`.", + "default": "prod_5h1pp1ng" }, "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." + "description": "Product source ID.", + "default": "5h1pp1ng", + "example": "5h1pp1ng" }, - "object": { + "name": { "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "description": "Product name.", + "example": "Shipping", + "default": "Shipping" } } }, - "result": { - "type": "string", + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of shipping items is based on a formula.", + "default": false, "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "promotion_tier": { + 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", - "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." - } - } + "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)." } } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of initial redemption." } } }, - "19_res_redemptions_POST": { + "19_obj_validations-true_result_loyalty_card": { "type": "object", - "title": "Stackable Redemptions Response Body", - "description": "Response body schema for POST `/redemptions`.", + "title": "Loyalty Card", + "description": "This is a `result` object representing the results for a loyalty card.", "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": { + "loyalty_card": { + "description": "Stores the amount of loyalty card points to be applied in the 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." + "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" }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" }, - "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" - } - } + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "redemption" - ] + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" }, - "voucher": { - "type": "null" + { + "$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." } } - }, - "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.", + "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": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." }, - "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." + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" }, - "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." + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" }, - "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." + "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" }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" }, - "amount": { + "applied_discount_amount": { "type": "integer", - "description": "Order amount before applying any discount." + "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" }, - "total_amount": { + "items_applied_discount_amount": { "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." + "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 that have been applied to the order.", + "description": "Array of order items showing the effects of particular discounts on the item-level.", "items": { "type": "object", "properties": { @@ -16594,7 +13839,7 @@ }, "subtotal_amount": { "type": "integer", - "description": "Final order item amount after the removing an item-level discount." + "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", @@ -16625,185 +13870,66 @@ "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_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." + "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." + } + } + } + } + } }, - "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." + "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." }, - "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." + "customer_id": { + "type": "null" }, - "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." + "referrer_id": { + "type": "null" }, - "status": { + "object": { "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, + "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." + "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`" + "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", @@ -16811,15 +13937,19 @@ }, "applied_discount_amount": { "type": "integer", - "description": "This field shows the order-level discount applied." + "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": "This field sums up all order-level and all product-specific discounts applied in a particular request." + "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 that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "description": "Array of order items showing the effects of particular discounts on the item-level.", "items": { "type": "object", "properties": { @@ -16852,7 +13982,7 @@ }, "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`" + "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", @@ -16904,288 +14034,939 @@ } } } - } - }, - "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." + } + }, + "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" + } + ] + } + }, + "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" + } + }, + "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." + } + } + }, + "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": "Object containing information about the customer that is making the purchase.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." + "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", - "default": "customer", - "description": "Type of object represented by the `customer` object." + "description": "Type of object represented is `customer`.", + "default": "customer" } } }, - "referrer": { + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { "type": "object", - "description": "Object containing information about the referrer.", + "description": "Defines the details of the voucher.", "properties": { "id": { "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" }, - "object": { + "code": { "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." + "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" } } }, - "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": { + "redemption": { "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" + "description": "Unique redemption ID of the original redemption." } } }, - "7_obj_order_object_apply_to_items": { + "19_obj_redemption_rollback_object_gift_card_stacked": { "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.", + "title": "Rollback Gift Card", + "description": "This is an object representing a gift card redemption rollback.", "properties": { "id": { "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. " + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." }, - "source_id": { + "customer_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." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "created_at": { + "tracking_id": { "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." + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "updated_at": { + "date": { "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" - ] + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, "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." + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + "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" + } + ] }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied." + "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" + } + } }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." }, - "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." - } + "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." } } }, - "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." + "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": "Rollback 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": "Object containing information about the customer that is making the purchase.", + "description": "Defines the customer that is related to the redemption.", "properties": { "id": { "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." + "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", - "default": "customer", - "description": "Type of object represented by the `customer` object." + "description": "Type of object represented is `customer`.", + "default": "customer" } } }, - "referrer": { + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "promotion_tier": { "type": "object", - "description": "Object containing information about the referrer.", + "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." + } + } + }, + "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": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." }, "object": { "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." + "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" } } }, - "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" + "order": { + "description": "Contains the order details associated with the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_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.", + "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. " + "description": "Unique order ID, assigned by Voucherify." }, "source_id": { "type": "string", @@ -17207,47 +14988,20 @@ "type": "string", "description": "Order status.", "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" + "CANCELED" ] }, "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`" + "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. Each order item can show the effects of particular discounts on the item-level.", + "description": "Array of order items that have been applied to the order.", "items": { "type": "object", "properties": { @@ -17274,21 +15028,13 @@ "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`" + "description": "Final order item amount after the removing an item-level discount." }, "product": { "type": "object", @@ -17394,751 +15140,784 @@ "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" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Lists details related to the redemption and redemption rollback.", "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": { + "redemption_ID": { "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": "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." + } + } } } - }, - "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" - ] - } - } - }, - "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." + "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" }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." + { + "$ref": "#/components/schemas/7_obj_order_object_apply_to_items" } - } + ] }, - "7_obj_redemption_object_loyalty_card_extended": { + "7_obj_order_object_apply_to_order": { "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).", + "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": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." }, - "object": { + "source_id": { "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" + "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." }, - "date": { + "created_at": { "type": "string", "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." }, - "customer_id": { + "updated_at": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "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." }, - "tracking_id": { + "status": { "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." + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, "amount": { "type": "integer", - "description": "Number of points being redeemed for a reward." + "description": "Order amount before applying any discount." }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "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`" }, - "channel": { + "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": "Defines the details of the channel through which the redemption was issued.", + "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": { - "channel_id": { + "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." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." }, - "channel_type": { + "object": { "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" - ] + "default": "customer", + "description": "Type of object represented by the `customer` object." } } }, - "customer": { + "referrer": { "type": "object", - "description": "Defines the customer redeeming the reward.", + "description": "Object containing information about the referrer.", "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." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." }, "object": { "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "default": "customer", + "description": "Type of object represented by the `referrer` object." } } }, - "related_object_type": { + "customer_id": { "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" }, - "related_object_id": { + "referrer_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." + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." }, - "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" - } - ] + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." }, - "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." - } - } + "redemptions": { + "description": "Lists details related to the redemption.", + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" } } }, - "7_obj_redemption_object_loyalty_card_extended_stacked": { + "7_obj_order_object_apply_to_items": { "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption.", + "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": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " }, - "object": { + "source_id": { "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" + "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." }, - "date": { + "created_at": { "type": "string", "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." }, - "customer_id": { + "updated_at": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "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." }, - "tracking_id": { + "status": { "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." + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, "amount": { "type": "integer", - "description": "Number of points being redeemed for a reward." + "description": "Order amount before applying any discount." }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" }, - "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" - ] + "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": "Defines the customer redeeming the reward.", + "description": "Object containing information about the customer that is making the purchase.", "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" + "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." } - ] + } }, - "loyalty_card": { + "referrer": { "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "description": "Object containing information about the referrer.", "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." + "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_object_gift_card_extended": { + "7_obj_order_object_stacked_redemptions": { "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", + "title": "Order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", "properties": { "id": { "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " }, - "object": { + "source_id": { "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" + "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." }, - "date": { + "created_at": { "type": "string", "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." }, - "customer_id": { + "updated_at": { "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." + "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." }, - "tracking_id": { + "status": { "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." + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, "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": "Order amount before applying any discount." }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" }, - "channel": { + "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": "Defines the details of the channel through which the redemption was issued.", + "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": { - "channel_id": { + "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." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." }, - "channel_type": { + "object": { "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" - ] + "default": "customer", + "description": "Type of object represented by the `customer` object." } } }, - "customer": { + "referrer": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Object containing information about the referrer.", "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." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." }, "object": { "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "default": "customer", + "description": "Type of object represented by the `referrer` object." } } }, - "related_object_type": { + "customer_id": { "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" - ] + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" }, - "related_object_id": { + "referrer_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." }, - "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)." - } - } + "redemptions": { + "description": "Lists details related to the redemption", + "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" } } }, - "7_obj_redemption_object_gift_card_extended_stacked": { + "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": "Gift Card", - "description": "This is an object representing a gift card redemption.", + "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", @@ -18170,15 +15949,6 @@ "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": [ @@ -18212,7 +15982,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Defines the customer that is related to the redemption.", "properties": { "id": { "type": "string", @@ -18256,81 +16026,29 @@ "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_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": { + "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": "rr_0bc92f81a6801f9bca", - "description": "Unique rollback redemption ID." + "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_rollback`.", - "default": "redemption_rollback" + "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 rollback occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, "customer_id": { "type": "string", @@ -18348,12 +16066,8 @@ }, "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." + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" }, "result": { "type": "string", @@ -18361,24 +16075,24 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption rollback result." + "description": "Redemption result." }, "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" + "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 rollback was issued.", + "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 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." + "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 rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "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" @@ -18435,26 +16149,26 @@ } } }, - "7_obj_rollback_redemption_object_loyalty_card_extended": { + "7_obj_redemption_object_loyalty_card_extended": { "type": "object", "title": "Loyalty Card Voucher", - "description": "This is an object representing a loyalty card rollback redemption.", + "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": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." + "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_rollback`.", - "default": "redemption_rollback" + "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 rollback occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, "customer_id": { "type": "string", @@ -18472,12 +16186,7 @@ }, "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" + "description": "Number of points being redeemed for a reward." }, "result": { "type": "string", @@ -18485,24 +16194,24 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption rollback result." + "description": "Redemption result." }, "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" + "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 rollback was issued.", + "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 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." + "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 rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "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" @@ -18576,36 +16285,36 @@ }, "loyalty_card": { "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "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 returned to the loyalty card for the reward redemption rollback." + "description": "Number of points being subtracted from the loyalty card for the reward redemption." } } } } }, - "7_obj_rollback_redemption_object_gift_card_extended": { + "7_obj_redemption_object_loyalty_card_extended_stacked": { "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card rollback redemption.", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption.", "properties": { "id": { "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." + "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_rollback`.", - "default": "redemption_rollback" + "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 rollback occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, "customer_id": { "type": "string", @@ -18623,12 +16332,12 @@ }, "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)." + "description": "Number of points being redeemed for a reward." }, "redemption": { "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" }, "result": { "type": "string", @@ -18636,24 +16345,24 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption rollback result." + "description": "Redemption result." }, "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" + "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 rollback was issued.", + "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 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." + "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 rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "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" @@ -18663,7 +16372,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -18680,7 +16389,7 @@ }, "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." + "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", @@ -18695,7 +16404,7 @@ }, "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. |", + "description": "Defines the related object. i.e. `voucher`.", "enum": [ "voucher" ] @@ -18708,38 +16417,55 @@ "$ref": "#/components/schemas/1_obj_voucher_object", "description": "Defines the details of the voucher being redeemed." }, - "gift": { + "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": "Contains the amount being added back to the gift card for the redemption rollback.", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", "properties": { - "amount": { + "points": { "type": "integer", - "description": "The amount added back on the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + "description": "Number of points being subtracted from the loyalty card for the reward redemption." } } } } }, - "7_obj_rollback_redemption_object_promotion_tier_extended": { + "7_obj_redemption_object_gift_card_extended": { "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier rollback redemption.", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", "properties": { "id": { "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." + "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_rollback`.", + "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 rollback occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, "customer_id": { "type": "string", @@ -18755,10 +16481,9 @@ "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" + "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", @@ -18766,24 +16491,24 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption rollback result." + "description": "Redemption result." }, "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" + "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 rollback was issued.", + "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 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." + "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 rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "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" @@ -18793,7 +16518,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the customer redeeming the gift card.", "properties": { "id": { "type": "string", @@ -18825,46 +16550,35 @@ }, "related_object_type": { "type": "string", - "description": "Defines the related object.", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", "enum": [ - "promotion_tier" + "voucher" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, "voucher": { - "type": "null" + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." }, - "promotion_tier": { + "gift": { "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", + "description": "Contains the amount being subtracted from the gift card for the redemption.", "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." - } - } + "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": { + "7_obj_redemption_object_gift_card_extended_stacked": { "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).", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", "properties": { "id": { "type": "string", @@ -18896,9 +16610,14 @@ "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." + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" }, "result": { "type": "string", @@ -18933,7 +16652,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the customer redeeming the gift card.", "properties": { "id": { "type": "string", @@ -18975,40 +16694,72 @@ "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": "Defines the details of the voucher being redeemed.", + "description": "Contains the amount being subtracted from the gift card for the redemption.", "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" + "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_rollback_object_discount_voucher": { + "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": "Rollback Discount Voucher", - "description": "This is an object representing a redemption rollback for a discount voucher.", + "title": "Discount Voucher", + "description": "This is an object representing a redemption.", "properties": { "id": { "type": "string", - "example": "rr_0c5eba630bc4979e70", - "description": "Unique redemption rollback ID." + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique rollback redemption ID." }, "object": { "type": "string", @@ -19037,7 +16788,8 @@ }, "redemption": { "type": "string", - "description": "Unique redemption ID of the original redemption." + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" }, "reason": { "type": "string", @@ -19118,39 +16870,19 @@ "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" - } - } + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." } } }, - "7_obj_redemption_rollback_object_loyalty_card": { + "7_obj_rollback_redemption_object_loyalty_card_extended": { "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a loyalty card rollback redemption.", "properties": { "id": { "type": "string", - "example": "rr_0c5eaf4060133bf784", + "example": "rr_0bc92f81a6801f9bca", "description": "Unique redemption rollback ID." }, "object": { @@ -19184,7 +16916,8 @@ }, "redemption": { "type": "string", - "description": "Unique redemption ID of the original redemption." + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" }, "result": { "type": "string", @@ -19261,31 +16994,11 @@ "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" - } - } + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." }, "reward": { - "description": "Defines the reward that was initially redeemed.", + "description": "Defines the reward being redeemed.", "anyOf": [ { "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" @@ -19307,32 +17020,32 @@ "properties": { "points": { "type": "integer", - "description": "Number of points being added back to the loyalty card for the reward redemption rollback." + "description": "Number of points being returned to the loyalty card for the reward redemption rollback." } } } } }, - "7_obj_redemption_object_loyalty_card": { + "7_obj_rollback_redemption_object_gift_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).", + "title": "Gift Card", + "description": "This is an object representing a gift card rollback redemption.", "properties": { "id": { "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "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.", - "default": "redemption" + "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 occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, "customer_id": { "type": "string", @@ -19350,11 +17063,12 @@ }, "amount": { "type": "integer", - "description": "Number of points being redeemed for a reward." + "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 parent redemption if this particular redemption was issued through a stacked redemption." + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" }, "result": { "type": "string", @@ -19362,134 +17076,34 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption result." + "description": "Redemption rollback result." }, "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "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 was issued.", + "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. 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." + "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.", + "description": "Defines the customer redeeming the gift card.", "properties": { "id": { "type": "string", @@ -19506,7 +17120,7 @@ }, "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." + "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", @@ -19519,74 +17133,107 @@ } } }, - "assignment_id": { + "related_object_type": { "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] }, - "id": { + "related_object_id": { "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, - "object": { + "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", - "default": "reward", - "description": "Type of object represented is `reward`." + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." }, - "name": { + "object": { "type": "string", - "description": "Reward name." + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption" }, - "created_at": { + "date": { "type": "string", "format": "date-time", "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, - "updated_at": { + "customer_id": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "parameters": { + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { "type": "object", - "description": "These are parameters representing a Pay with Points (COIN) reward.", + "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": { - "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." - } - } + "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" + ] } } }, - "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.", + "description": "Defines the customer that is related to the redemption.", "properties": { "id": { "type": "string", @@ -19603,7 +17250,7 @@ }, "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." + "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", @@ -19616,183 +17263,117 @@ } } }, - "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": { + "related_object_type": { "type": "string", - "description": "Reward name." + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] }, - "created_at": { + "related_object_id": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." }, - "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." + "voucher": { + "type": "null" }, - "parameters": { + "promotion_tier": { "type": "object", - "description": "These are parameters representing a material reward.", + "description": "Contains details of the promotion tier and the parent campaign.", "properties": { - "product": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { "type": "object", - "description": "Defines the product redeemed as a reward.", + "description": "Promotion tier's parent campaign.", "properties": { "id": { "type": "string", - "description": "Unique product ID assignedy by Voucherify of the product.", - "example": "prod_0b2c2ddf35150b83bb" - }, - "sku_id": { - "type": "null" + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } } } } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "MATERIAL" - ] } - }, - "title": "Product Material Reward" + } }, - "7_obj_redemption_object_loyalty_card_material_sku": { + "7_obj_redemption_object_discount_voucher": { "type": "object", - "description": "Defines the SKU material reward redeemed for the particular loyalty card.", + "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": { - "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": { + "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" + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." }, - "sku": { - "description": "Details of the SKU redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_sku_object" + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" }, - "id": { + "date": { "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "object": { + "customer_id": { "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "name": { + "tracking_id": { "type": "string", - "description": "Reward name." + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "created_at": { + "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", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." }, - "updated_at": { + "result": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." }, - "parameters": { + "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": "These are parameters representing a material reward.", + "description": "Defines the details of the channel through which the redemption was issued.", "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." - } - } + "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" + ] } } }, - "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.", + "description": "Defines the customer that is related to the redemption.", "properties": { "id": { "type": "string", @@ -19809,7 +17390,7 @@ }, "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." + "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", @@ -19822,144 +17403,51 @@ } } }, - "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": { + "related_object_type": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] }, - "updated_at": { + "related_object_id": { "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, - "parameters": { + "voucher": { "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.", + "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": { - "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": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } } - }, - "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": { + "7_obj_redemption_rollback_object_discount_voucher": { "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", + "title": "Rollback Discount Voucher", + "description": "This is an object representing a redemption rollback for a discount voucher.", "properties": { "id": { "type": "string", - "example": "rr_0bc92f81a6801f9bca", + "example": "rr_0c5eba630bc4979e70", "description": "Unique redemption rollback ID." }, "object": { @@ -19987,14 +17475,9 @@ "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" + "description": "Unique redemption ID of the original redemption." }, "reason": { "type": "string", @@ -20033,7 +17516,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Defines the customer that is related to the redemption.", "properties": { "id": { "type": "string", @@ -20097,39 +17580,29 @@ "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)." - } - } } } }, - "7_obj_redemption_object_gift_card": { + "7_obj_redemption_rollback_object_loyalty_card": { "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", + "title": "Rollback Loyalty Card Voucher", + "description": "This is an object representing a redemption rollback for a loyalty card.", "properties": { "id": { "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "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`.", - "default": "redemption" + "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 occured." + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, "customer_id": { "type": "string", @@ -20147,11 +17620,11 @@ }, "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": "Number of points being returned to the loyalty card." }, "redemption": { "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + "description": "Unique redemption ID of the original redemption." }, "result": { "type": "string", @@ -20159,24 +17632,24 @@ "SUCCESS", "FAILURE" ], - "description": "Redemption result." + "description": "Redemption rollback result." }, "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "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 was issued.", + "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. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + "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. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "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" @@ -20186,7 +17659,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer redeeming the gift card.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -20203,7 +17676,7 @@ }, "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." + "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", @@ -20218,7 +17691,7 @@ }, "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. |", + "description": "Defines the related object. i.e. `voucher`.", "enum": [ "voucher" ] @@ -20251,31 +17724,48 @@ } } }, - "gift": { + "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": "Contains the amount being subtracted from the gift card for the redemption.", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", "properties": { - "amount": { + "points": { "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + "description": "Number of points being added back to the loyalty card for the reward redemption rollback." } } } } }, - "7_obj_redemption_object_voucher_fail": { + "7_obj_redemption_object_loyalty_card": { "type": "object", - "title": "Failed Voucher Redemption", - "description": "This is an object representing a failed redemption for a voucher.", + "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": "rf_0bbaccc96e0830ff9e", - "description": "Unique failed redemption ID." + "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`.", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", "default": "redemption" }, "date": { @@ -20298,6 +17788,14 @@ "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": [ @@ -20306,17 +17804,9 @@ ], "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" + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" }, "channel": { "type": "object", @@ -20339,7 +17829,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -20356,7 +17846,7 @@ }, "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." + "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", @@ -20371,19 +17861,18 @@ }, "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", + "description": "Defines the related object. i.e. `voucher`.", "enum": [ "voucher" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, "voucher": { "type": "object", - "description": "Defines the voucher details.", + "description": "Defines the details of the voucher being redeemed.", "properties": { "id": { "type": "string", @@ -20404,86 +17893,43 @@ "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" + "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" + } + ] }, - "channel": { + "loyalty_card": { "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", "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" - ] + "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 promotion.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -20500,7 +17946,7 @@ }, "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." + "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", @@ -20513,223 +17959,175 @@ } } }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { + "assignment_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "voucher": { - "type": "null" + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." }, - "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_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." + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." }, "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." + "default": "reward", + "description": "Type of object represented is `reward`." }, - "result": { + "name": { "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." + "description": "Reward name." }, - "failure_code": { + "created_at": { "type": "string", - "example": "not_found", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." }, - "failure_message": { + "updated_at": { "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" + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." }, - "channel": { + "parameters": { "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", + "description": "These are parameters representing a Pay with Points (COIN) reward.", "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" - ] + "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." + } + } } } }, - "customer": { - "type": "null" - }, - "related_object_type": { + "type": { "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", + "description": "Reward type", "enum": [ - "redemption" + "COIN" ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "rf_0c5bde8dfc0156f0e3" - }, - "voucher": { - "type": "null" } - } + }, + "title": "Pay with Points Reward" }, - "7_obj_redemption_rollback_object_voucher_fail": { + "7_obj_redemption_object_loyalty_card_material_product": { "type": "object", - "title": "Failed Voucher Redemption Rollback", - "description": "This is an object representing a failed redemption rollback for a voucher.", + "description": "Defines the product material reward redeemed for the particular loyalty card.", "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." + "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" + } + } }, - "tracking_id": { + "assignment_id": { "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + "product": { + "description": "Details of the product redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_product_object_truncated" }, - "redemption": { + "id": { "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." }, - "reason": { + "object": { "type": "string", - "description": "The reason for the redemption rollback." + "default": "reward", + "description": "Type of object represented is `reward`." }, - "result": { + "name": { "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." + "description": "Reward name." }, - "failure_code": { + "created_at": { "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." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." }, - "failure_message": { + "updated_at": { "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" + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." }, - "channel": { + "parameters": { "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", + "description": "These are parameters representing a material reward.", "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" - ] + "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" + ] + } + }, + "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 that is related to the redemption.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -20746,7 +18144,7 @@ }, "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." + "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", @@ -20759,130 +18157,82 @@ } } }, - "related_object_type": { + "assignment_id": { "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" - ] + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + "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" }, - "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." + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." }, "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." + "default": "reward", + "description": "Type of object represented is `reward`." }, - "result": { + "name": { "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." + "description": "Reward name." }, - "failure_code": { + "created_at": { "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." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." }, - "failure_message": { + "updated_at": { "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" + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." }, - "channel": { + "parameters": { "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", + "description": "These are parameters representing a material reward.", "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" - ] + "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" + ] + } + }, + "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 promotion.", + "description": "Defines the customer redeeming the reward.", "properties": { "id": { "type": "string", @@ -20899,7 +18249,7 @@ }, "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." + "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", @@ -20912,49 +18262,140 @@ } } }, - "related_object_type": { + "assignment_id": { "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." }, - "related_object_id": { + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Voucher object." + }, + "id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." }, - "voucher": { - "type": "null" + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." }, - "promotion_tier": { + "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": "Contains details about the promotion tier and it's parent campaign.", + "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": { - "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." + "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" + ] + } + }, + "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_rollback_object_promotion_tier": { + "7_obj_redemption_object_loyalty_card_digital_gift_card_credits": { "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", + "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", @@ -20986,9 +18427,18 @@ "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 initial redemption." + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0c5bf3323008a35032" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." }, "result": { "type": "string", @@ -21023,7 +18473,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the customer redeeming the gift card.", "properties": { "id": { "type": "string", @@ -21055,46 +18505,55 @@ }, "related_object_type": { "type": "string", - "description": "Defines the related object.", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", "enum": [ - "promotion_tier" + "voucher" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, "voucher": { - "type": "null" - }, - "promotion_tier": { "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", + "description": "Defines the details of the voucher being redeemed.", "properties": { "id": { "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." }, "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." - } - } + "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)." } } } } }, - "7_obj_redemption_object_promotion_tier": { + "7_obj_redemption_object_gift_card": { "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", "properties": { "id": { "type": "string", @@ -21126,6 +18585,10 @@ "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." @@ -21163,7 +18626,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "Defines the customer redeeming the gift card.", "properties": { "id": { "type": "string", @@ -21195,169 +18658,60 @@ }, "related_object_type": { "type": "string", - "description": "Defines the related object.", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", "enum": [ - "promotion_tier" + "voucher" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." }, "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_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.", + "description": "Defines the details of the voucher being redeemed.", "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." + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" }, - "email": { + "code": { "type": "string", - "description": "Customer's email address." + "description": "Unique voucher code." }, - "source_id": { + "campaign": { "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." + "description": "Voucher's parent campaign name." }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } } }, - "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" + "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_promotion_tier_extended_stacked": { + "7_obj_redemption_object_voucher_fail": { "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", + "title": "Failed Voucher Redemption", + "description": "This is an object representing a failed redemption for a voucher.", "properties": { "id": { "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "example": "rf_0bbaccc96e0830ff9e", + "description": "Unique failed redemption ID." }, "object": { "type": "string", @@ -21384,11 +18738,6 @@ "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": [ @@ -21397,9 +18746,17 @@ ], "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": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" + "type": "null" }, "channel": { "type": "object", @@ -21454,37 +18811,55 @@ }, "related_object_type": { "type": "string", - "description": "Defines the related object.", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", "enum": [ - "promotion_tier" + "voucher" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + "description": "Unique related object ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" }, "voucher": { - "type": "null" - }, - "promotion_tier": { - "description": "Contains details of the promotion tier and the parent campaign.", - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + "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_stackable_discounts": { + "7_obj_redemption_object_promotion_tier_fail": { "type": "object", - "title": "Stacked Redemption", - "description": "This is an object representing a stacked redemption.", + "title": "Failed Promotion Tier Redemption", + "description": "This is an object representing a failed redemption for a promotion tier.", "properties": { "id": { "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." + "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`.", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", "default": "redemption" }, "date": { @@ -21515,9 +18890,17 @@ ], "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": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + "type": "null" }, "channel": { "type": "object", @@ -21540,7 +18923,7 @@ }, "customer": { "type": "object", - "description": "Defines the customer making the stacked redemption.", + "description": "Defines the customer redeeming the promotion.", "properties": { "id": { "type": "string", @@ -21572,3122 +18955,2543 @@ }, "related_object_type": { "type": "string", - "description": "Defines the related object.", + "description": "Defines the related object.\n", "enum": [ - "redemption" + "promotion_tier" ] }, "related_object_id": { "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, "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": [ - "category" - ], - "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": { - "type": "string", - "enum": [ - "category" - ], - "example": "category" - } - } - } - } - } - }, - "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": { + "promotion_tier": { "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.", + "description": "Contains details about the promotion tier and it's parent campaign.", "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" + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - { - "$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" + "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_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." - } - }, - "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" - ], + "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", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Loyalty campaign name." + "example": "rf_0c4c7baf58c243af6b", + "description": "Unique failed redemption ID." }, - "campaign_type": { + "object": { "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" }, - "type": { + "date": { "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" - ] + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + "customer_id": { + "type": "null", + "description": "Unique customer ID of the redeeming customer." }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + "tracking_id": { + "type": "null", + "description": "Hashed customer source ID." }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "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." + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." }, - "start_date": { + "failure_code": { "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" + "example": "not_found", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." }, - "expiration_date": { + "failure_message": { "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" + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." }, - "validity_timeframe": { + "order": { + "type": "null" + }, + "channel": { "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`.", + "description": "Defines the details of the channel through which the redemption was issued.", "properties": { - "interval": { + "channel_id": { "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." + "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." }, - "duration": { + "channel_type": { "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 source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } } }, - "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" - } + "customer": { + "type": "null" }, - "activity_duration_after_publishing": { + "related_object_type": { "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": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", + "enum": [ + "redemption" + ] }, - "description": { + "related_object_id": { "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + "description": "Unique related object ID assigned by Voucherify.", + "example": "rf_0c5bde8dfc0156f0e3" }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." + "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." }, - "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" + "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 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." + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "created_at": { + "redemption": { "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." + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" }, - "updated_at": { + "reason": { "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." + "description": "The reason for the redemption rollback." }, - "creation_status": { + "result": { "type": "string", "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" + "SUCCESS", + "FAILURE" ], - "description": "Indicates the status of the campaign creation." + "description": "Redemption rollback result." }, - "vouchers_generation_status": { + "failure_code": { "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." + "example": "already_rolled_back", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." }, - "category_id": { + "failure_message": { "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "order": { + "type": "null" }, - "loyalty_tiers_expiration": { + "channel": { "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + "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." }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + "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" ] }, - "object": { + "related_object_id": { "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." + "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" + } + } } } }, - "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.", + "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", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + "example": "rrf_0c5eb3bd884497ed05", + "description": "Unique failed redemption rollback ID." }, - "name": { + "object": { "type": "string", - "description": "Loyalty campaign name." + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" }, - "description": { + "date": { "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, - "campaign_type": { + "customer_id": { "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "type": { + "tracking_id": { "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" - ] + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." }, - "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." + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." }, - "start_date": { + "failure_code": { "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" + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." }, - "expiration_date": { + "failure_message": { "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" + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." }, - "validity_timeframe": { + "order": { + "type": "null" + }, + "channel": { "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`.", + "description": "Defines the details of the channel through which the redemption rollback was issued.", "properties": { - "interval": { + "channel_id": { "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." + "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." }, - "duration": { + "channel_type": { "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 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" + ] } } }, - "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": { + "customer": { "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." + "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" + } + } }, - "vouchers_generation_status": { + "related_object_type": { "type": "string", - "description": "Indicates the status of the campaign's vouchers.", + "description": "Defines the related object.\n", "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" + "promotion_tier" ] }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { + "related_object_id": { "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } + "voucher": { + "type": "null" }, - "loyalty_tiers_expiration": { + "promotion_tier": { "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + "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" }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + "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": "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", + "7_obj_redemption_rollback_object_promotion_tier": { "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" - } - ], + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption rollback", "properties": { "id": { "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." }, - "code": { + "object": { "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." + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" }, - "campaign": { + "date": { "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." }, - "campaign_id": { + "customer_id": { "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "category": { + "tracking_id": { "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } + "redemption": { + "type": "string", + "description": "Unique redemption ID of initial redemption." }, - "type": { + "result": { "type": "string", "enum": [ - "LOYALTY_CARD" + "SUCCESS", + "FAILURE" ], - "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" + "description": "Redemption rollback result." }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" }, - "loyalty_card": { + "channel": { "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "description": "Defines the details of the channel through which the redemption rollback was issued.", "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": { + "channel_id": { "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." + "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." }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." + "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" + ] } } }, - "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": { + "customer": { "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`.", + "description": "Defines the customer that is related to the redemption.", "properties": { - "duration": { + "id": { "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." + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "interval": { + "name": { "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." + "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" } } }, - "validity_day_of_week": { - "type": "array", + "related_object_type": { + "type": "string", + "description": "Defines the related object.", "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" + "promotion_tier" + ] }, - "additional_info": { + "related_object_id": { "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." }, - "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." + "voucher": { + "type": "null" }, - "assets": { + "promotion_tier": { "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "description": "Contains details of the promotion tier and the parent campaign.", "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`" - } - } + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "barcode": { + "campaign": { "type": "object", - "description": "Stores barcode representation of encrypted code.", + "description": "Promotion tier's parent campaign.", "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`" + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } } } } + } + } + }, + "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." }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "created_at": { + "object": { "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" + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" }, - "updated_at": { + "date": { "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." + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "holder_id": { + "customer_id": { "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." + "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": "Stores a summary of redemptions that have been applied to the voucher.", + "description": "Defines the details of the channel through which the redemption was issued.", "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + "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." }, - "redeemed_quantity": { - "type": "integer", - "example": 1, - "description": "How many times a voucher has already been redeemed." + "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" }, - "redeemed_points": { - "type": "integer", - "example": 100000, - "description": "Total loyalty points redeemed." + "name": { + "type": "string", + "description": "Customer's first and last name." }, - "object": { + "email": { "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." + "description": "Customer's email address." }, - "url": { + "source_id": { "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`" + "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" } } }, - "publish": { + "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": "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", + "description": "Contains details of the promotion tier and the parent campaign.", "properties": { - "object": { + "id": { "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." + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "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`" + "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", - "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", + "7_obj_redemption_object_promotion_tier_extended": { "type": "object", - "description": "This is an object representing a loyalty reward.", - "x-tags": [ - "LOYALTIES API" - ], + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", "properties": { - "reward": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." }, "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": { + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { "type": "string", - "example": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", - "description": "Unique loyalty points bucket ID." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "voucher_id": { + "customer_id": { "type": "string", - "example": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "description": "Unique parent loyalty card ID." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "campaign_id": { + "tracking_id": { "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "description": "Unique parent campaign ID." + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "bucket": { + "metadata": { "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." - } - } + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "status": { + "result": { "type": "string", "enum": [ - "ACTIVE" + "SUCCESS", + "FAILURE" ], - "description": "Loyalty points bucket point status." + "description": "Redemption result." }, - "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." + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" }, - "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." + "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" + ] + } + } }, - "updated_at": { + "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", - "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." + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] }, - "object": { + "related_object_id": { "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" + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "voucher": { + "type": "null" }, - "object": { - "type": "string", - "default": "loyalty_tier_reward", - "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward." + "promotion_tier": { + "description": "Contains details of the promotion tier and the parent campaign.", + "$ref": "#/components/schemas/3_obj_promotion_tier_object" } } }, - "8_obj_loyalty_card_object_non_expanded_categories": { - "title": "Loyalty Card Object", + "7_obj_redemption_object_promotion_tier_extended_stacked": { "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" - } - ], + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", "properties": { "id": { "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." }, - "code": { + "object": { "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." + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" }, - "campaign": { + "date": { "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "campaign_id": { + "customer_id": { "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "category": { + "tracking_id": { "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" }, - "type": { + "result": { "type": "string", "enum": [ - "LOYALTY_CARD" + "SUCCESS", + "FAILURE" ], - "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" + "description": "Redemption result." }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" }, - "loyalty_card": { + "channel": { "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "description": "Defines the details of the channel through which the redemption was issued.", "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": { + "channel_id": { "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." + "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." }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." + "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" + ] } } }, - "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": { + "customer": { "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`.", + "description": "Defines the customer that is related to the redemption.", "properties": { - "duration": { + "id": { "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." + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "interval": { + "name": { "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." + "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" } } }, - "validity_day_of_week": { - "type": "array", + "related_object_type": { + "type": "string", + "description": "Defines the related object.", "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" + "promotion_tier" + ] }, - "additional_info": { + "related_object_id": { "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." + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." }, - "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`" - } - } - } - } + "voucher": { + "type": "null" }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." + "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." }, - "created_at": { + "object": { "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" + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" }, - "updated_at": { + "date": { "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." + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." }, - "holder_id": { + "customer_id": { "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." }, - "redemption": { + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { "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": { + "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", - "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." + "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." }, - "url": { + "channel_type": { "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`" + "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" + ] } } }, - "publish": { + "customer": { "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", + "description": "Defines the customer making the stacked redemption.", "properties": { - "object": { + "id": { "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." + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "count": { - "type": "integer", - "example": 0, - "description": "Publication events counter." + "name": { + "type": "string", + "description": "Customer's first and last name." }, - "url": { + "email": { "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`" + "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" } } }, - "object": { + "related_object_type": { "type": "string", - "description": "The type of object represented by JSON. Default is `voucher`.", - "default": "voucher" + "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" } } }, - "8_res_get_loyalty_card_transactions": { - "title": "Get Loyalty Card Transactions Response Body", + "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": "List of loyalty card transactions", + "description": "Response body schema for **GET** `/redemptions`.", "properties": { "object": { "type": "string", "default": "list", - "description": "The type of object represented by JSON." + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." }, "data_ref": { "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of transaction objects." + "default": "redemptions", + "description": "Identifies the name of the attribute that contains the array of redemption 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" - } + "redemptions": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" + } + ] }, - "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." + "total": { + "type": "integer", + "description": "Total number of redemptions." } } }, - "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" + "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" + } }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual_custom_event" + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_refund" + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_addition" + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_removal" + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_expiration" + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_out" + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_in" + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." } - ] + } }, - "1_obj_loyalty_card_transaction_object_redemption": { - "title": "Redemption", - "description": "When loyalty points are used to pay for an order.", + "7_res_get_vouchers_redemptions": { "type": "object", + "title": "Get Voucher's Redemptions Response Body", + "description": "Response body schema for **GET** `/vouchers/{code}/redemption`.", "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" + "quantity": { + "type": "integer", + "description": "The maximum number of times a voucher can be redeemed." }, - "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`." + "redeemed_quantity": { + "type": "integer", + "description": "The number of times the voucher was redeemed successfully." }, - "voucher_id": { + "object": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "default": "list", + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." }, - "campaign_id": { + "url": { "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" + "example": "/v1/vouchers/PROMO-CODE2/redemptions?page=1&limit=10", + "description": "URL " }, - "source": { + "data_ref": { "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`." + "default": "redemption_entries", + "description": "Identifies the name of the attribute that contains the array of `redemption_entries`." }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + "total": { + "type": "integer", + "description": "Total number of redemption objects." }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REDEMPTION", - "enum": [ - "POINTS_REDEMPTION" - ] + "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" }, - "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." - } - } + { + "$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" }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } - } + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" }, - "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" - } - } + { + "$ref": "#/components/schemas/9_req_create_customer" } - } + ], + "description": "Customer's information." }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + "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." }, - "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": "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)." } } }, - "1_obj_loyalty_card_transaction_object_accrual": { - "title": "Accrual", - "description": "When points are earned on the card through an earning rule.", + "7_req_redeem_voucher_discount_code": { + "title": "Discount Code", "type": "object", + "description": "Redeem a discount code.", "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" - ] + "session": { + "$ref": "#/components/schemas/6_req_session_lock_discount_code" }, - "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" - } - } - } - } + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, - "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." - } - } + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" }, - "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" - } - } + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, - "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." - } - } - } - } + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } - } + ], + "description": "Order information." }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + "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)." }, - "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." + "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" + } + } + } } } }, - "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.", + "7_req_redeem_voucher_gift_card": { + "title": "Gift Card", "type": "object", + "description": "Redeem a gift card.", "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" - ] + "session": { + "$ref": "#/components/schemas/6_req_session_lock_gift_card" }, - "details": { + "gift": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", "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" - } - } - } - } + "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" }, - "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" - } - } + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" }, - "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." - } - } - } - } + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_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.", - "example": "event_0cc916d8374bfe8bc2" - }, - "type": { - "type": "string", - "description": "Type of custom event.", - "example": "user_subscribed" - } - } + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" }, - "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" - } - } + { + "$ref": "#/components/schemas/10_req_create_order" } - } + ], + "description": "Order information." }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + "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)." }, - "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." + "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" + } + } + } } } }, - "1_obj_loyalty_card_transaction_object_refund": { - "title": "Refund", - "description": "When points are credited back to a card through a redemption rollback.", + "7_req_redeem_voucher_loyalty_card": { + "title": "Loyalty Card", "type": "object", + "description": "Redeem a loyalty card.", "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" + "session": { + "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" }, - "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" + "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." + } + } }, - "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`." + "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." }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points refund, this value is `null`." + "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." }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REFUND", - "enum": [ - "POINTS_REFUND" - ] + "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)." }, - "details": { + "options": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "description": "Configure parameters returned in the response.", "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" - } + "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_req_rollback_redemption": { + "title": "Rollback Redemption Request Body", + "type": "object", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_id" }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID.", - "example": "rr_0c9b0967244a862a33" - } - } + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_source_id" }, - "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" - } - } + { + "$ref": "#/components/schemas/9_req_create_customer" } - } + ], + "description": "Customer's information." }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + "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." }, - "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": "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`." }, - "1_obj_loyalty_card_transaction_object_addition": { - "title": "Addition", - "description": "When points are added to a card.", + "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 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." + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" }, - "voucher_id": { + "name": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "description": "Loyalty campaign name." }, - "campaign_id": { + "campaign_type": { "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" + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." }, - "source": { + "type": { "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "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": [ - "voucherify-web-ui", - "API" + "AUTO_UPDATE", + "STATIC" ] }, - "reason": { + "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", - "description": "Reason why the transaction occurred." + "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" }, - "type": { + "expiration_date": { "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ADDITION", - "enum": [ - "POINTS_ADDITION" - ] + "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" }, - "details": { + "validity_timeframe": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "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": { - "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" - } - } - } - } + "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." } } }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + "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" + } }, - "created_at": { + "activity_duration_after_publishing": { "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": { + "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": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." }, - "source_id": { + "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", - "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." + "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." }, - "voucher_id": { + "updated_at": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "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." }, - "campaign_id": { + "creation_status": { "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" + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." }, - "source": { + "vouchers_generation_status": { "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "description": "Indicates the status of the campaign's vouchers.", "enum": [ - "voucherify-web-ui", - "API" + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." }, - "type": { + "category_id": { "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REMOVAL", - "enum": [ - "POINTS_REMOVAL" - ] + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" }, - "details": { + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "loyalty_tiers_expiration": { "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" - } - } - } - } + "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" } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." + ] }, - "created_at": { + "object": { "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." + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." } } }, - "1_obj_loyalty_card_transaction_object_expiration": { - "title": "Expiration", - "description": "When points expire.", + "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 transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" }, - "source_id": { + "name": { "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`." + "description": "Loyalty campaign name." }, - "voucher_id": { + "description": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." }, - "campaign_id": { + "campaign_type": { "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" + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." }, - "source": { + "type": { "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "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": [ - "Automation" + "AUTO_UPDATE", + "STATIC" ] }, - "reason": { + "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", - "description": "Reason why the transaction occurred. In case of a points expiration, this value is `null`." + "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" }, - "type": { + "expiration_date": { "type": "string", - "description": "Type of transaction.", - "default": "POINTS_EXPIRATION", - "enum": [ - "POINTS_EXPIRATION" - ] + "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" }, - "details": { + "validity_timeframe": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "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": { - "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" - } - } - } - } + "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." } } }, - "related_transaction_id": { + "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": "This field is `null` in the case of this type of transaction." + "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": "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." + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." }, - "voucher_id": { + "updated_at": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "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." }, - "campaign_id": { + "creation_status": { "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" + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." }, - "source": { + "vouchers_generation_status": { "type": "string", - "description": "The channel through which the transaction took place.", + "description": "Indicates the status of the campaign's vouchers.", "enum": [ - "API" + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." }, - "type": { + "category_id": { "type": "string", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_OUT", - "enum": [ - "POINTS_TRANSFER_OUT" - ] + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" }, - "details": { + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "loyalty_tiers_expiration": { "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" - } - } - } - } + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" }, - "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." - } - } + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" } - } - }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the receiving card.", - "example": "vtx_0c9afe802593b34b81" + ] }, - "created_at": { + "object": { "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." + "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" } - } - }, - "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" + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." }, - "source_id": { + "code": { "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`." + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." }, - "voucher_id": { + "campaign": { "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." }, "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" + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." }, - "source": { + "category": { "type": "string", - "description": "The channel through which the transaction took place.", - "enum": [ - "API" - ] + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." }, - "reason": { + "category_id": { "type": "string", - "description": "Reason why the transaction occurred." + "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", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_IN", "enum": [ - "POINTS_TRANSFER_IN" - ] + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher. " }, - "details": { + "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": "Contains the detailed information about the transaction.", + "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": "Contains information on how the balance was affected by the transaction.", + "description": "Stores Quick Response (QR) representation of encrypted code.", "properties": { - "type": { + "id": { "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." + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." }, - "object": { + "url": { "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" - } - } + "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`" } } }, - "source_voucher": { + "barcode": { "type": "object", - "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction.", + "description": "Stores barcode representation of encrypted code.", "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" + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." }, - "campaign_id": { + "url": { "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." + "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`" } } } } }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the source card.", - "example": "vtx_0c9afe802593b34b81" + "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", - "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." + "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_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", + "loyalties_loyalty_tier_reward": { + "title": "Loyalty Tier Reward Object", "type": "object", + "description": "This is an object representing a loyalty tier reward.", + "x-tags": [ + "LOYALTIES API" + ], "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" - ] + "reward": { + "$ref": "#/components/schemas/reward" }, - "fields": { - "type": "array", + "assignment": { + "$ref": "#/components/schemas/reward_assignment" + }, + "object": { + "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward.", "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" - } + "loyalty_tier_reward" + ] } - } + }, + "required": [ + "reward", + "assignment", + "object" + ] }, - "8_obj_export_transactions_object": { - "title": "Export Object", + "8_obj_loyalty_card_object_non_expanded_categories": { + "title": "Loyalty Card 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.", + "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", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." }, - "object": { + "code": { "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." }, - "created_at": { + "campaign": { "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" + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." }, - "status": { + "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", - "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" - ] + "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." + } + } }, - "channel": { + "start_date": { "type": "string", - "description": "The channel through which the export was triggered.", - "default": "API" + "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. " }, - "exported_object": { + "expiration_date": { "type": "string", - "description": "The type of exported object.", - "default": "voucher_transactions" - }, - "parameters": { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + "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." }, - "result": { + "validity_timeframe": { "type": "object", - "description": "Contains the URL of the CSV file.", + "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": { - "url": { + "duration": { "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + "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." } } }, - "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." + "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" + } }, - "name": { - "type": "string", - "description": "Loyalty Tier name." + "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" }, - "campaign_id": { + "additional_info": { "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." + "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 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." + "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." }, - "earning_rules": { + "assets": { "type": "object", - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", "properties": { - "unique_earning_rule_ID": { - "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" + "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." }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" + "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`" } - ] - } - } - }, - "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" + } + }, + "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." }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" + "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`" } - ] + } } } }, - "config": { + "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": "Defines loyalty tier range in points.", + "description": "Stores a summary of redemptions that have been applied to the voucher.", "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." - } - } + "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`" } } }, - "points": { + "publish": { "type": "object", - "description": "Defines range of loyalty tier in points.", + "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": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." + "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." }, - "to": { + "count": { "type": "integer", - "description": "Top points threshold value." + "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", - "default": "loyalty_tier", - "description": "The type of object represented by JSON. This object stores information about the loyalty." + "description": "The type of object represented by JSON. Default is `voucher`.", + "default": "voucher" } } }, - "8_obj_loyalty_tier_object_member": { + "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.", @@ -24729,408 +21533,111 @@ "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" - }, - "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" - } + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] } - }, - "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" + "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." + } } } - }, - "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" + "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." + } } }, - { - "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": {} + "object": { + "type": "string", + "default": "loyalty_tier", + "description": "The type of object represented by JSON. This object stores information about the loyalty." } - ], - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" + } + }, + "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" + ] }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" + "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" + ] }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." } - ] + } }, - "8_obj_earning_rule_object_no_validation_rule": { + "8_obj_earning_rule_object": { "description": "This is an object representing an earning rule.", "title": "Earning Rule Object", "examples": [ @@ -25309,454 +21816,82 @@ "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." - } - } - }, - "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" - } + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" } }, - "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" + { + "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" } }, - "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", + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, "validation_rule_id": null, "loyalty": { - "points": 1000, + "points": 5, "type": "FIXED" }, - "event": "order.paid", + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", "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" + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} } ], - "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": { - "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." + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" }, - "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" - } - } + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" }, - "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" - } + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" }, - "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." + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" } - } + ] }, - "8_obj_earning_rule_object_order_paid_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", @@ -25809,7 +21944,7 @@ "format": "date-time" }, "validation_rule_id": { - "type": "null", + "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." }, @@ -25907,26 +22042,23 @@ } } }, - "8_obj_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", + "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 Entered Segment", + "title": "Earning Rule Object for Order Paid", "examples": [ { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", + "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" }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", + "event": "order.paid", "source": { - "banner": "Entered segment 100 points.", + "banner": "Order paid 1000 points", "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", "object_type": "campaign" }, @@ -25938,34 +22070,13 @@ "interval": "P1D" }, "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 + 4 ], "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + "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", @@ -25978,26 +22089,16 @@ "$ref": "#/components/schemas/8_obj_fixed_points" }, { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } ] }, - "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" + "order.paid" ], - "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." + "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", @@ -26007,16 +22108,6 @@ "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`." } } }, @@ -26059,42 +22150,29 @@ "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.", + "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 Entered Segment", + "title": "Earning Rule Object for Order Paid", "examples": [ { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", + "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" }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", + "event": "order.paid", "source": { - "banner": "Entered segment 100 points.", + "banner": "Order paid 1000 points", "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", "object_type": "campaign" }, @@ -26106,14 +22184,10 @@ "interval": "P1D" }, "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 + 4 ], "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" } ], "properties": { @@ -26129,27 +22203,10 @@ "$ref": "#/components/schemas/8_obj_fixed_points" }, { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } ] }, - "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.", @@ -26206,7 +22263,7 @@ } } }, - "8_req_update_earning_rule_object_entered_segment": { + "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", @@ -26264,6 +22321,23 @@ } ] }, + "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.", @@ -26320,7 +22394,7 @@ } } }, - "8_obj_earning_rule_object_entered_segment_no_validation_rule": { + "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", @@ -26362,183 +22436,6 @@ } ], "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." - } - } - }, - "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", @@ -26550,32 +22447,11 @@ { "$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.", @@ -26584,16 +22460,6 @@ "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`." } } }, @@ -26636,23 +22502,13 @@ "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": { + "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", @@ -26686,6 +22542,23 @@ } ], "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", @@ -26731,6 +22604,16 @@ "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`." } } }, @@ -26773,13 +22656,23 @@ "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_update_earning_rule_object_custom_event": { + "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", @@ -26832,6 +22725,24 @@ } ] }, + "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.", @@ -26888,7 +22799,7 @@ } } }, - "8_obj_earning_rule_object_custom_event_no_validation_rule": { + "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", @@ -26922,25 +22833,8 @@ } ], "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", + "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." }, @@ -26958,24 +22852,6 @@ } ] }, - "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.", @@ -26984,16 +22860,6 @@ "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`." } } }, @@ -27036,16 +22902,6 @@ "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." @@ -27375,142 +23231,6 @@ } } }, - "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", @@ -28399,177 +24119,6 @@ ] } }, - "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" - ] - } - }, - "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", @@ -28616,113 +24165,6 @@ } } }, - "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", @@ -28920,187 +24362,6 @@ } } }, - "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" - } - }, - "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" - } - } - } - } - }, - "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", @@ -29271,17 +24532,6 @@ } } }, - "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", @@ -29345,61 +24595,6 @@ } } }, - "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", @@ -29439,7 +24634,7 @@ "$ref": "#/components/schemas/4_obj_reward_assignment_object" } }, - "8_req_update_reward_assignment": { + "rewards_update_assignment_request_body": { "title": "Update Reward Assignment Request Body", "type": "object", "description": "Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}`.", @@ -29462,33 +24657,7 @@ } } }, - "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": { + "loyalties_list_loyalty_tier_rewards_response_body": { "title": "List Loyalty Tier Rewards", "type": "object", "description": "Response schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`.", @@ -29507,14 +24676,20 @@ "type": "array", "description": "Contains array of loyalty tier reward objects.", "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_reward_object" + "$ref": "#/components/schemas/loyalties_loyalty_tier_reward" } }, "total": { "type": "integer", "description": "Total number of loyalty tier reward objects." } - } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] }, "8_res_list_members": { "title": "List Members", @@ -29633,62 +24808,6 @@ } } }, - "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", @@ -30653,414 +25772,6 @@ } } }, - "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", @@ -31230,16 +25941,6 @@ } ] }, - "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`.", @@ -32835,100 +27536,6 @@ } } }, - "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.", @@ -34668,10 +29275,10 @@ } } }, - "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)", + "description": "This is an object representing a validation rule assignment.", "x-tags": [ "VALIDATION RULES API" ], @@ -34712,11 +29319,22 @@ "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", @@ -34735,14 +29353,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`.", @@ -34998,14 +29622,6 @@ } } }, - "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", @@ -35076,7 +29692,8 @@ }, "customer": { "type": "object", - "description": "An empty customer object." + "description": "A simple customer object", + "$ref": "#/components/schemas/SimpleCustomerResponse" }, "referral": { "type": "null", @@ -35164,7 +29781,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" @@ -35188,83 +29805,6 @@ } } }, - "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", @@ -35641,9 +30181,9 @@ } } }, - "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", + "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", "properties": { "order": { @@ -35657,29 +30197,20 @@ "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. |", + "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" } }, "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.", @@ -35943,7 +30474,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": { @@ -35955,8 +30486,8 @@ } } }, - "16_obj_filter_gift_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", + "voucher_transactions_export_filter_conditions": { + "description": "Filter conditions set on the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", "properties": { @@ -35966,10 +30497,13 @@ "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`.", + "description": "Filter conditions set on the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", "properties": { @@ -36100,73 +30634,6 @@ } } }, - "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", @@ -36196,35 +30663,6 @@ } } }, - "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", @@ -36256,6 +30694,42 @@ } } }, + "16_filter_conditions_string_qualification": { + "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" + } + }, + "$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." + } + } + } + } + }, "17_obj_async_action_object": { "title": "Async Action Object", "type": "object", @@ -36544,61 +31018,6 @@ } } }, - "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", @@ -36675,6 +31094,174 @@ } } }, + "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." + } + } + }, "17_res_obj_get_async_action_result_campaign_vouchers_update": { "title": "CAMPAIGN.VOUCHERS_UPDATE", "type": "object", @@ -39235,12 +33822,21 @@ }, "filters": { "description": "A set of fiters to return only a specific category or type of redeemable.", - "anyOf": [ + "allOf": [ + { + "$ref": "#/components/schemas/23_obj_filter_category_id" + }, + { + "$ref": "#/components/schemas/23_obj_filter_campaign_id" + }, { "$ref": "#/components/schemas/23_obj_filter_resource_type" }, { - "$ref": "#/components/schemas/23_obj_filter_category_id" + "$ref": "#/components/schemas/23_obj_filter_voucher_type" + }, + { + "$ref": "#/components/schemas/qualificationJunction" } ] } @@ -39315,32 +33911,51 @@ } } }, + "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_qualification" + } + } + }, + "23_obj_filter_campaign_id": { + "description": "Filter conditions set on the resource `campaign_id`.", + "title": "Filter by campaign ID", + "type": "object", + "properties": { + "campaign_id": { + "$ref": "#/components/schemas/16_filter_conditions_string_qualification" + } + } + }, "23_obj_filter_resource_type": { - "description": "Filter conditions set on the resource `type`. The resource types include: `voucher`, `promotion_tier`, `campaign`.", + "description": "Filter conditions set on the resource `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" + "$ref": "#/components/schemas/16_filter_conditions_string_qualification" } } }, - "23_obj_filter_category_id": { - "description": "Filter conditions set on the resource `category_id`.", - "title": "Filter by category ID", + "23_obj_filter_voucher_type": { + "description": "Filter conditions set on the resource `voucher_type`.", + "title": "Filter by type", "type": "object", "properties": { - "category_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" + "voucher_type": { + "$ref": "#/components/schemas/16_filter_conditions_string_qualification" } } }, + "qualificationJunction": { + "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", + "$ref": "#/components/schemas/Junction" + }, "23_obj_qualification_redeemables": { "title": "Redeemables", "type": "object", @@ -39374,6 +33989,421 @@ } } }, + "PromotionsStacksListInCampaignResponseBody": { + "title": "Promotions Stacks List In Campaign Response Body", + "x-stoplight": { + "id": "4vg6isqaq6snd" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "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/PromotionStack" + } + }, + "total": { + "type": "integer", + "minimum": 0, + "description": "Total number of promotion stacks." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "PromotionsStacksListResponseBody": { + "title": "Promotions Stacks List Response Body", + "x-stoplight": { + "id": "xulqc9a55rqq1" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "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/PromotionStack" + } + }, + "total": { + "type": "integer", + "minimum": 0, + "description": "Total number of promotion stacks." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "PromotionsStacksListRequestQuery": { + "title": "Promotions Stacks List Request Query", + "x-stoplight": { + "id": "tlxava3tsdz67" + }, + "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", + "name", + "-name" + ], + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + }, + "created_at": { + "type": "object", + "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", + "properties": { + "before": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time before the voucher was created in ISO 8601 format." + }, + "after": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time after the voucher was created in ISO 8601 format." + } + } + }, + "updated_at": { + "type": "object", + "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", + "properties": { + "before": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time before the voucher was updated in ISO 8601 format." + }, + "after": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time after the voucher was updated in ISO 8601 format." + } + } + } + } + }, + "PromotionsStacksGetResponseBody": { + "$ref": "#/components/schemas/PromotionStack", + "title": "Promotions Stacks Get Response Body" + }, + "PromotionsStacksUpdateRequestBody": { + "title": "Promotions Stacks Update Request Body", + "x-stoplight": { + "id": "8jlymzh3ddocw" + }, + "type": "object", + "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", + "enum": [ + "MANUAL" + ], + "description": "Category hierarchy." + } + } + }, + "category_id": { + "type": "string", + "description": "Promotion stack category ID." + } + } + }, + "PromotionsStacksUpdateResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/PromotionStackBase" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion stack ID." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." + }, + "campaign_id": { + "type": "string", + "description": "Promotion stack's parent campaign's unique ID." + }, + "object": { + "type": "string", + "enum": [ + "promotion_stack" + ], + "description": "The type of object represented by JSON. " + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Promotion stack category ID." + }, + "categories": { + "type": "array", + "description": "Details about the category assigned to the promotion stack.", + "items": { + "$ref": "#/components/schemas/PromotionStackBase" + } + } + }, + "required": [ + "id", + "created_at", + "updated_at", + "campaign_id", + "object", + "category_id", + "categories" + ] + } + ] + }, + "PromotionsStacksCreateInCampaignRequestBody": { + "allOf": [ + { + "$ref": "#/components/schemas/PromotionStackBase" + }, + { + "type": "object", + "properties": { + "category_id": { + "type": "string", + "description": "Promotion stack category ID." + } + } + } + ] + }, + "PromotionsStacksCreateInCampaignResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/PromotionStackBase" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion stack ID." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." + }, + "campaign_id": { + "type": "string", + "description": "Promotion stack's parent campaign's unique ID." + }, + "object": { + "type": "string", + "enum": [ + "promotion_stack" + ], + "description": "The type of object represented by JSON." + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Promotion stack category ID." + }, + "categories": { + "type": "array", + "description": "Details about the category assigned to the promotion stack.", + "items": { + "$ref": "#/components/schemas/PromotionStackBase" + } + } + }, + "required": [ + "id", + "created_at", + "campaign_id", + "object", + "category_id", + "categories" + ] + } + ] + }, + "PromotionStackBase": { + "title": "Promotion Stack Base", + "x-stoplight": { + "id": "m7vtpwtnuvjpe" + }, + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Promotion stack name." + }, + "tiers": { + "type": "object", + "required": [ + "ids" + ], + "description": "Contains the tier configuration.", + "properties": { + "ids": { + "type": "array", + "minItems": 1, + "description": "Contains the list of tiers in a pre-defined sequence.", + "items": { + "type": "string" + } + }, + "hierarchy_mode": { + "type": "string", + "enum": [ + "MANUAL" + ] + } + } + } + }, + "required": [ + "name", + "tiers" + ] + }, + "PromotionStack": { + "allOf": [ + { + "$ref": "#/components/schemas/PromotionStackBase" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion stack ID." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." + }, + "campaign_id": { + "type": "string", + "description": "Promotion stack's parent campaign's unique ID." + }, + "object": { + "type": "string", + "enum": [ + "promotion_stack" + ], + "description": "The type of object represented by JSON. " + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Promotion stack category ID." + }, + "categories": { + "type": "array", + "description": "Details about the category assigned to the promotion stack.", + "items": { + "$ref": "#/components/schemas/Category" + } + } + }, + "required": [ + "id", + "created_at", + "campaign_id", + "object", + "category_id", + "categories" + ] + } + ] + }, "LoyaltiesGetPointsExpirationResponseBody": { "title": "Loyalties Get Points Expiration Response Body", "type": "object", @@ -39478,6 +34508,7 @@ ] }, "LoyaltiesGetEarningRuleResponseBody": { + "title": "Loyalties Get Earning Rule Response Body", "$ref": "#/components/schemas/EarningRule" }, "LoyaltiesEnableEarningRulesResponseBody": { @@ -39540,9 +34571,6 @@ }, "EarningRuleBase": { "title": "EarningRuleBase", - "x-stoplight": { - "id": "w4ci1ljqva0r1" - }, "type": "object", "properties": { "id": { @@ -39680,9 +34708,6 @@ }, "EarningRuleEvent": { "title": "EarningRuleEvent", - "x-stoplight": { - "id": "6vxql7fnzg2zp" - }, "type": "string", "enum": [ "order.paid", @@ -39697,9 +34722,6 @@ }, "EarningRuleFixed": { "title": "Define fixed amount of points", - "x-stoplight": { - "id": "r5o8m0sdli7fq" - }, "type": "object", "properties": { "type": { @@ -39731,9 +34753,6 @@ }, "EarningRuleProportionalOrderAmount": { "title": "Order Amount", - "x-stoplight": { - "id": "1z7lk7z1lp5af" - }, "type": "object", "properties": { "type": { @@ -39785,9 +34804,6 @@ }, "EarningRuleProportionalOrderTotalAmount": { "title": "Order Total Amount", - "x-stoplight": { - "id": "ekudxr430edgk" - }, "type": "object", "properties": { "type": { @@ -39839,9 +34855,6 @@ }, "EarningRuleProportionalOrderMetadata": { "title": "Order Metadata", - "x-stoplight": { - "id": "4ccw4gz8b47u5" - }, "type": "object", "properties": { "type": { @@ -39899,9 +34912,6 @@ }, "EarningRuleProportionalOrderItemsQuantity": { "title": "Order Items Quantity", - "x-stoplight": { - "id": "pqsn9otpzyot9" - }, "type": "object", "properties": { "type": { @@ -39968,9 +34978,6 @@ }, "EarningRuleProportionalOrderItemsAmount": { "title": "Order Items Amount", - "x-stoplight": { - "id": "8pg4o23daepkb" - }, "type": "object", "properties": { "type": { @@ -40037,9 +35044,6 @@ }, "EarningRuleProportionalOrderItemsSubtotalAmount": { "title": "Order Items Subtotal Amount", - "x-stoplight": { - "id": "duxy5qw36h5ph" - }, "type": "object", "properties": { "type": { @@ -40897,286 +35901,226 @@ "user_id" ] }, - "RewardAssignment": { - "title": "Reward Assignment", + "reward": { + "allOf": [ + { + "$ref": "#/components/schemas/reward_identity" + }, + { + "$ref": "#/components/schemas/reward_base" + }, + { + "$ref": "#/components/schemas/reward_created" + } + ] + }, + "reward_base": { "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique reward assignment ID, assigned by Voucherify." - }, - "reward_id": { + "name": { "type": "string", - "description": "Associated reward ID." + "description": "Reward name." }, - "related_object_id": { - "type": "string", - "description": "Related object ID to which the reward was assigned." + "stock": { + "type": [ + "integer", + "null" + ], + "description": "Configurable for **material rewards**. The number of units of the product that you want to share as reward." }, - "related_object_type": { - "type": "string", - "description": "Related object type to which the reward was assigned." + "redeemed": { + "type": [ + "integer", + "null" + ], + "description": "Defines the number of already invoked (successful) reward redemptions.\t" }, - "parameters": { + "attributes": { "type": "object", - "description": "Defines the cost of the reward.", + "description": "These properties are configurable for **material rewards**.", "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" - ] + "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": "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." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN", + "COIN", + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/reward_type", + "description": "Defines how the reward is generated." + } + }, + "required": [ + "name", + "type", + "stock", + "redeemed", + "attributes", + "metadata" + ] + }, + "reward_identity": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "description": "Unique reward ID, assigned by Voucherify." + } + }, + "required": [ + "id" + ] + }, + "reward_created": { + "type": "object", + "properties": { "created_at": { "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "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", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "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" }, "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." + "description": "The type of object represented by the JSON. This object stores information about the reward.", + "enum": [ + "reward" + ] } }, "required": [ - "id", - "reward_id", "created_at", + "updated_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": [ - "id", - "created_at", - "object" - ] - }, - { - "$ref": "#/components/schemas/RewardType" - } - ] - }, - "RewardType": { - "title": "Reward Type", - "anyOf": [ + "reward_type": { + "oneOf": [ { - "$ref": "#/components/schemas/RewardTypeCampaign" + "$ref": "#/components/schemas/reward_type_campaign" }, { - "$ref": "#/components/schemas/RewardTypeCoin" + "$ref": "#/components/schemas/reward_type_coin" }, { - "$ref": "#/components/schemas/RewardTypeCoin" + "$ref": "#/components/schemas/reward_type_material" } ] }, - "RewardTypeCoin": { - "title": "Reward Type Coin", + "reward_type_coin": { + "title": "Reward Type - Coin", "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "COIN" - ], - "description": "Reward type." - }, - "parameters": { + "coin": { "type": "object", "required": [ - "coin" + "exchange_ratio" ], - "description": "Defines how the reward is generated.", + "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", "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." - } - } + "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", - "parameters" - ] + }, "required": ["coin"] }, - "RewardTypeMaterial": { - "title": "Reward Type Material", + "reward_type_material": { + "title": "Reward Type - Material", "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { + "product": { "type": "object", "required": [ - "product" + "id", + "sku" ], - "description": "Defines how the reward is generated.", + "description": "Contains information about the product given as a reward.", "properties": { - "product": { - "type": "object", - "required": [ - "id", - "sku" + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify." + }, + "sku": { + "type": [ + "string", + "null" ], - "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." - } - } + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." } } } }, "required": [ - "type", - "parameters" + "product" ] }, - "RewardTypeCampaign": { - "title": "Reward Type Campaign", + "reward_type_campaign": { + "title": "Reward Type - Campaign", "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Reward type." - }, - "parameters": { + "campaign": { "type": "object", "required": [ - "campaign" + "id", + "type" ], - "description": "Defines how the reward is generated.", + "description": "Objects stores information about the campaign related to the reward.", "properties": { - "campaign": { - "type": "object", - "required": [ - "id", - "type" + "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": "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." - } - } + "description": "Campaign type." } } } }, "required": [ - "type", - "parameters" + "campaign" ] }, "LoyaltiesAddOrRemoveCardBalanceResponseBody": { @@ -42863,7 +37807,7 @@ }, "ExportsGetResponseBody": { "$ref": "#/components/schemas/Export", - "title": "" + "title": "Exports Get Response Body" }, "ExportsListResponseBody": { "title": "Exports List Response Body", @@ -43373,9 +38317,6 @@ }, "LoyaltiesCreateTiersRequestBody": { "title": "Loyalties Create Tiers Request Body", - "x-stoplight": { - "id": "i1emmwlaqp7lt" - }, "type": "array", "items": { "allOf": [ @@ -43396,31 +38337,21 @@ }, "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" - } + "title": "Loyalties Get Reward Assignment Response Body", + "$ref": "#/components/schemas/reward_assignment" }, "LoyaltiesGetRewardDetailsResponseBody": { - "$ref": "#/components/schemas/Reward", - "x-stoplight": { - "id": "44hds9u0hhukf" - } + "title": "Loyalties Get Reward Details Response Body", + "$ref": "#/components/schemas/reward" }, "LoyaltiesListTiersRequestQuery": { "title": "Loyalties List Tiers Request Query", - "x-stoplight": { - "id": "d5sluzqkxu8km" - }, "type": "object", "properties": { "limit": { @@ -43445,11 +38376,50 @@ } } }, + "LoyaltiesListMemberRewardsResponseBody": { + "title": "LoyaltiesListMemberRewardsResponseBody", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ] + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ] + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "reward": { + "$ref": "#/components/schemas/reward" + }, + "assignment": { + "$ref": "#/components/schemas/reward_assignment" + }, + "object": { + "type": "string", + "enum": [ + "loyalty_reward" + ] + } + } + } + }, + "total": { + "type": "integer", + "minimum": 0 + } + } + }, "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", - "x-stoplight": { - "id": "zs0z1cyyzac9u" - }, "type": "object", "properties": { "limit": { @@ -43465,16 +38435,11 @@ } }, "LoyaltiesGetTierResponseBody": { - "$ref": "#/components/schemas/LoyaltyTier", - "x-stoplight": { - "id": "hzcsijl2b4d5o" - } + "title": "Loyalties Get Tier Response Body", + "$ref": "#/components/schemas/LoyaltyTier" }, "LoyaltiesListTiersResponseBody": { "title": "Loyalties List Tiers Response Body", - "x-stoplight": { - "id": "kw06g2szvv479" - }, "type": "object", "properties": { "object": { @@ -43512,9 +38477,6 @@ }, "LoyaltiesListMemberLoyaltyTiersResponseBody": { "title": "Loyalties List Member Loyalty Tiers Response Body", - "x-stoplight": { - "id": "s3zpgud510xl6" - }, "type": "object", "properties": { "object": { @@ -43587,9 +38549,6 @@ }, "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", - "x-stoplight": { - "id": "i180zbh3ffwaa" - }, "type": "object", "properties": { "object": { @@ -43627,9 +38586,6 @@ }, "LoyaltyTierBase": { "title": "Loyalty Tier Base", - "x-stoplight": { - "id": "3af9422223696" - }, "type": "object", "properties": { "name": { @@ -43787,9 +38743,6 @@ }, "MappingMultiply": { "title": "MappingMultiply", - "x-stoplight": { - "id": "7zrwgr2oqh4tj" - }, "type": "object", "properties": { "type": { @@ -43807,9 +38760,6 @@ }, "MappingFixed": { "title": "MappingFixed", - "x-stoplight": { - "id": "86eksegayxcxa" - }, "type": "object", "properties": { "type": { @@ -43835,6 +38785,226 @@ } ] }, + "Category": { + "title": "Category", + "description": "This is an object representing a category.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "object": { + "type": "string", + "default": "category", + "enum": [ + "category" + ], + "description": "The type of object represented by the JSON. This object stores information about the category." + }, + "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" + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object" + ], + "examples": [ + { + "id": "cat_0b60cfe7d0d7ddbb55", + "name": "CategoryName", + "hierarchy": 1, + "created_at": "2022-07-14T10:45:13.156Z", + "updated_at": "2022-08-16T11:03:54.727Z", + "object": "category" + } + ] + }, + "CategoriesListResponseBody": { + "title": "CategoriesListResponseBody", + "type": "object", + "description": "Response schema for **GET** `/categories`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about categories in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of category objects." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Category" + } + }, + "total": { + "type": "integer", + "description": "Total number of categories." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ], + "x-stoplight": { + "id": "c967c76fc93e1" + } + }, + "CategoriesCreateRequestBody": { + "title": "CategoriesCreateRequestBody", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + } + }, + "required": [ + "name", + "hierarchy" + ] + }, + "CategoriesCreateResponseBody": { + "title": "CategoriesCreateResponseBody", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "object": { + "type": "string", + "default": "category", + "enum": [ + "category" + ] + }, + "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" + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object" + ] + }, + "CategoriesGetResponseBody": { + "$ref": "#/components/schemas/Category" + }, + "CategoriesUpdateRequestBody": { + "title": "CategoriesUpdateRequestBody", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + } + }, + "required": [ + "name", + "hierarchy" + ] + }, + "CategoriesUpdateResponseBody": { + "title": "CategoriesUpdateResponseBody", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "object": { + "type": "string", + "default": "category", + "enum": [ + "category" + ] + }, + "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" + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object", + "updated_at" + ] + }, "a_req_importCSV": { "type": "object", "title": "Import CSV file", @@ -43872,19 +39042,6 @@ "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", @@ -44050,38 +39207,6 @@ } } }, - "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", @@ -44489,37 +39614,10 @@ "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." + "example": "There are not enough loyalty points on the card.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } } } }, @@ -44632,37 +39730,6 @@ } } }, - "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}`.\",", @@ -44846,6 +39913,61 @@ "name", "filter" ] + }, + "SimpleCustomerResponse": { + "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", + "metadata": { + "age": 24, + "loyalty_customer": "true", + "acquisition_channel": "Facebook" + }, + "object": "customer" + } + ], + "x-tags": [ + "EVENTS API" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_CSnYd37MXmrbS19XCrghjBsv", + "required": true + }, + "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": true + }, + "name": { + "type": "string", + "description": "Customer's first and last name.", + "required": true + }, + "email": { + "type": "string", + "description": "Customer's email address.", + "required": true + }, + "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. " + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the customer.", + "default": "customer", + "required": true + } + } } }, "examples": { @@ -45114,28 +40236,14 @@ } } } - } - }, - "/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", + }, + "post": { + "operationId": "generate-random-code", "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`.", + "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": [ { @@ -45143,433 +40251,546 @@ "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" + ] + } + }, + "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 + }, + "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" + } + ] + }, + "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" + } + } + }, + "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 + } + } + } + } + } + } + }, "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.", + "description": "Returns a voucher object if the call succeeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/1_obj_voucher_object" }, "examples": { - "Loyalty Card": { + "Percentage Discount": { "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, + "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": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 + "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" }, - "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" + "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/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + "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-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "created_at": "2022-02-17T07:14:40.096Z", + "updated_at": null, "validation_rules_assignments": { "object": "list", "data_ref": "data", - "data": [], - "total": 0 + "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": null, - "redeemed_quantity": 1, - "redeemed_points": 10, + "quantity": 10, + "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" }, "publish": { "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + "count": 0, + "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" }, "object": "voucher" } }, - "Gift Card": { + "Gift Voucher": { "value": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": null, + "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", + "code": "New-GIFT-CARD-8tqB6FcyhE0", + "campaign": null, + "campaign_id": null, + "category": "New Customers", "type": "GIFT_VOUCHER", "discount": null, "gift": { - "amount": 55000, - "balance": 44700, + "amount": 10000, + "balance": 10000, "effect": "APPLY_TO_ORDER" }, "loyalty_card": null, - "start_date": null, + "start_date": "2022-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": "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" + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" }, - "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" + "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": "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" + "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-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 - }, + "created_at": "2022-02-17T07:49:10.834Z", + "updated_at": null, "redemption": { "quantity": null, - "redeemed_quantity": 2, + "redeemed_quantity": 0, + "redeemed_amount": 0, "object": "list", - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" }, "publish": { "object": "list", - "count": 1, - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" + "count": 0, + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/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" - }, + "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": 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": null, - "metadata": {}, + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, "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" + "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": "U2FsdGVkX19t8/dJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB+p0gzGM0tyXa/npbPUTe0Y5Y/arDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy/20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19t8%2FdJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB%2Bp0gzGM0tyXa%2FnpbPUTe0Y5Y%2FarDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy%2F20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg%3D%3D" + "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-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 - }, + "created_at": "2022-02-17T08:06:41.091Z", + "updated_at": null, "redemption": { "quantity": null, - "redeemed_quantity": 3, + "redeemed_quantity": 0, + "redeemed_points": 0, "object": "list", - "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" }, "object": "voucher" } }, - "Fixed Discount": { + "Unit Discount Multiple Items": { "value": { - "id": "v_zXQtyi5FYQYoRXv459hmK8M5Gi2lLoDl", - "code": "FixedDiscountUsingFormula", + "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", + "code": "MultipleUnitTypesUnitDiscount", "campaign": null, "campaign_id": null, - "category": null, - "category_id": null, + "category": "New Customers", "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)" + "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": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, + "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+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" + "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+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": "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-09-15T12:46:55.818Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, + "created_at": "2022-02-18T06:27:45.619Z", + "updated_at": null, "redemption": { - "quantity": null, - "redeemed_quantity": 5, + "quantity": 5, + "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" }, "object": "voucher" } }, - "Unit Discount": { + "Unit Discount Single Item": { "value": { - "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", - "code": "UnitDiscountUsingFormula", + "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", + "code": "AddMissingItemDiscount", "campaign": null, "campaign_id": null, - "category": null, - "category_id": null, + "category": "New Customers", "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", + "unit_type": "prod_0a9f9ab4ab019a42d5", "effect": "ADD_MISSING_ITEMS" }, "gift": null, "loyalty_card": null, - "start_date": null, - "expiration_date": 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": true, - "additional_info": null, + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", "metadata": {}, "assets": { "qr": { - "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%3D" + "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": "U2FsdGVkX19E7POETWB9YO+S4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs/2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz+Ka/vTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr/ciSN8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19E7POETWB9YO%2BS4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs%2F2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz%2BKa%2FvTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr%2FciSN8%3D" + "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-09-15T13:36:27.838Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, + "created_at": "2022-02-18T06:46:44.536Z", + "updated_at": null, "redemption": { - "quantity": null, - "redeemed_quantity": 5, + "quantity": 3, + "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" + "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" + "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" }, "object": "voucher" } - }, - "Multiple Unit Discount": { + } + } + } + } + } + } + } + }, + "/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_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" - } - ] - }, + "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": 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, @@ -45579,17 +40800,18 @@ "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" + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%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": "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-16T05:44:50.722Z", - "updated_at": "2022-09-19T09:25:17.303Z", + "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", @@ -45598,34 +40820,34 @@ }, "redemption": { "quantity": null, - "redeemed_quantity": 3, + "redeemed_quantity": 1, + "redeemed_points": 10, "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" }, "publish": { "object": "list", - "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" }, "object": "voucher" } }, - "Free Shipping": { + "Gift Card": { "value": { - "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", - "code": "FreeShipping", - "campaign": null, - "campaign_id": null, + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", "category": null, "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "effect": "ADD_MISSING_ITEMS" + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 55000, + "balance": 44700, + "effect": "APPLY_TO_ORDER" }, - "gift": null, "loyalty_card": null, "start_date": null, "expiration_date": null, @@ -45636,17 +40858,18 @@ "metadata": {}, "assets": { "qr": { - "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%3D" + "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": "U2FsdGVkX19XHGrCUHCfcSz/VLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU+McRx9iEB/DqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19XHGrCUHCfcSz%2FVLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU%2BMcRx9iEB%2FDqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0%3D" + "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-09-16T07:19:53.945Z", - "updated_at": "2022-09-16T07:26:35.361Z", + "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", @@ -45655,356 +40878,204 @@ }, "redemption": { "quantity": null, - "redeemed_quantity": 2, + "redeemed_quantity": 7, + "redeemed_amount": 10300, "object": "list", - "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" }, "publish": { "object": "list", - "count": 0, - "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/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" - }, - "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" - } - } - }, - "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": [ - { - "unit_off": 2, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - { - "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": { + }, + "Amount Discount": { "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", + "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "code": "AMOUNTDISCOUNTUSINGFORMULA", "campaign": null, "campaign_id": null, - "category": "Second", - "category_id": "cat_0bb81a481615a37b5e", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", "categories": [ { - "id": "cat_0bb81a481615a37b5e", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-09-20T05:58:01.561Z", + "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": 1800, - "percent_off": 45, - "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "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": "2020-02-01T00:00:00.000Z", - "expiration_date": "2023-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "PT2H" - }, + "start_date": "2022-09-01T00:00:00.000Z", + "expiration_date": "2022-10-31T00:00:00.000Z", + "validity_timeframe": null, "validity_day_of_week": [ - 0, 1, - 2 + 2, + 3, + 4, + 5 ], - "active": false, - "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", - "metadata": { - "Season": "Winter" - }, + "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": "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" + "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%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" + "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-19T14:41:30.976Z", - "updated_at": "2022-09-20T06:00:50.202Z", + "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": [], - "total": 0 + "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": 101, - "redeemed_quantity": 0, + "quantity": null, + "redeemed_quantity": 2, "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" }, "publish": { "object": "list", - "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + "count": 1, + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" }, "object": "voucher" } }, - "Gift Card": { + "Percent Discount": { "value": { - "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", - "code": "welcomegiftcard", + "id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", + "code": "PercentDiscountUsingFormula", "campaign": null, "campaign_id": null, - "category": "Existing Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 20000, - "balance": 20000, + "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": "2021-01-01T00:00:00.000Z", + "start_date": null, "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" - }, + "active": true, + "additional_info": null, + "metadata": {}, "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" + "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": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" + "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-02-17T09:09:49.665Z", - "updated_at": "2022-02-17T11:11:48.071Z", + "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": [], - "total": 0 + "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": 0, - "redeemed_amount": 0, + "redeemed_quantity": 3, "object": "list", - "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" + "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" + "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" }, "object": "voucher" } }, - "Loyalty Card": { + "Fixed Discount": { "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 + "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": false, - "additional_info": "This loyalty card is being deactivated and points updated.", - "metadata": { - "test": false, - "locale": "de-en-pl" - }, + "active": true, + "additional_info": null, + "metadata": {}, "assets": { "qr": { - "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" + "id": "U2FsdGVkX1+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" }, "barcode": { - "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + "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-02-17T09:12:01.428Z", - "updated_at": "2022-02-17T11:20:12.447Z", + "created_at": "2022-09-15T12:46:55.818Z", + "updated_at": "2022-09-16T10:03:25.057Z", "validation_rules_assignments": { "object": "list", "data_ref": "data", @@ -46013,111 +41084,106 @@ }, "redemption": { "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, + "redeemed_quantity": 5, "object": "list", - "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" + "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" + "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" }, "object": "voucher" } }, - "Amount Discount": { + "Unit Discount": { "value": { - "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", - "code": "WelcomeDiscountAmount", + "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", + "code": "UnitDiscountUsingFormula", "campaign": null, "campaign_id": null, - "category": "Existing Customers", + "category": null, + "category_id": null, "type": "DISCOUNT_VOUCHER", "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ITEMS" + "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": "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" - }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, "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" + "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%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" + "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-02-17T11:41:05.236Z", - "updated_at": "2022-02-17T11:45:29.269Z", + "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": [ - { - "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 + "data": [], + "total": 0 }, "redemption": { - "quantity": 10, - "redeemed_quantity": 0, + "quantity": null, + "redeemed_quantity": 5, "object": "list", - "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" + "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" + "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" }, "object": "voucher" } }, - "Fixed Discount": { + "Multiple Unit Discount": { "value": { - "id": "v_B1Pe7QPTjXCHm8IcDkJAQs4g6Zc08UlK", - "code": "wou4w1Og", - "campaign": "Fixed", - "campaign_id": "camp_2jVA6EKGSAe6scyc3i1q9ROD", - "category": "Existing Customers", + "id": "v_5Xgi5ht4sw432LQ7bwmyjKnUAYtOrJAh", + "code": "UnitDiscountUsingFormulaForMultipleProductVariants", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, "type": "DISCOUNT_VOUCHER", "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS", - "fixed_amount": 2000 + "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": "2021-01-01T00:00:00.000Z", + "start_date": null, "expiration_date": null, "validity_timeframe": null, "validity_day_of_week": null, @@ -46126,17 +41192,17 @@ "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" + "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": "U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo/9bm/HNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3+Sw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo%2F9bm%2FHNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3%2BSw%3D%3D" + "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-02-17T11:54:37.766Z", - "updated_at": "2022-02-17T12:04:53.346Z", + "created_at": "2022-09-16T05:44:50.722Z", + "updated_at": "2022-09-19T09:25:17.303Z", "validation_rules_assignments": { "object": "list", "data_ref": "data", @@ -46144,77 +41210,56 @@ "total": 0 }, "redemption": { - "quantity": 1, - "redeemed_quantity": 0, + "quantity": null, + "redeemed_quantity": 3, "object": "list", - "url": "/v1/vouchers/wou4w1Og/redemptions?page=1&limit=10" + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/wou4w1Og/publications?page=1&limit=10" + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" }, "object": "voucher" } }, - "Unit Discount": { + "Free Shipping": { "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", + "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", + "code": "FreeShipping", "campaign": null, "campaign_id": null, - "category": "New Customers", + "category": null, + "category_id": null, "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" - } - ] + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "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" - }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, "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" + "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%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" + "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-02-18T06:27:45.619Z", - "updated_at": "2022-02-18T06:31:08.630Z", + "created_at": "2022-09-16T07:19:53.945Z", + "updated_at": "2022-09-16T07:26:35.361Z", "validation_rules_assignments": { "object": "list", "data_ref": "data", @@ -46222,15 +41267,15 @@ "total": 0 }, "redemption": { - "quantity": 5, - "redeemed_quantity": 0, + "quantity": null, + "redeemed_quantity": 2, "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" }, "object": "voucher" } @@ -46239,72 +41284,22 @@ } } }, - "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.", + "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": { - "Voucher Not Found": { + "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", + "details": "Cannot find voucher with id v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", + "request_id": "v-0bb3403b9a158c87b2", + "resource_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", "resource_type": "voucher" } } @@ -46314,13 +41309,13 @@ } } }, - "post": { - "operationId": "create-voucher", + "put": { + "operationId": "update-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.", + "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": [ { @@ -46329,142 +41324,112 @@ } ], "requestBody": { - "description": "Specify the details of the voucher that you would like to create.", + "required": true, + "description": "Specify the parameters to be updated.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_POST" + "$ref": "#/components/schemas/1_req_vouchers_code_PUT" }, "examples": { - "Percentage Discount": { + "Percent Discount": { "value": { - "category": "New Customers", + "category": "Second", "type": "DISCOUNT_VOUCHER", "discount": { - "percent_off": 10, "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": "2022-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", + "start_date": "2020-02-01T00:00:00Z", + "expiration_date": "2023-12-31T23:59:59Z", "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" + "duration": "PT2H", + "interval": "P3D" }, "validity_day_of_week": [ + 0, 1, - 2, - 3, - 4, - 5 + 2 ], "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 10 - }, + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", "metadata": { - "test": true, - "locale": "de-en" - }, - "validation_rules": [ - "val_4j7DCRm2IS59" - ] + "Season": "Winter" + } } }, "Gift Card": { "value": { - "category": "New Customers", - "type": "GIFT_VOUCHER", + "category": "Existing Customers", "gift": { - "amount": 10000, - "effect": "APPLY_TO_ORDER" + "amount": 20000, + "effect": "APPLY_TO_ITEMS" }, - "start_date": "2022-01-01T00:00:00Z", - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", + "start_date": "2021-01-01T00:00:00Z", + "active": false, + "additional_info": "This gift card is disabled.", "metadata": { - "test": true, - "locale": "de-en" + "test": false, + "locale": "de-en-pl" } } }, "Loyalty Card": { "value": { - "category": "New Customers", - "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "type": "LOYALTY_CARD", + "category": "Existing Customers", "loyalty_card": { - "points": 10000 + "points": 20000 }, - "additional_info": "This loyalty card is enabled immediately upon creation.", + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", "metadata": { - "test": true, - "locale": "de-en" + "test": false, + "locale": "de-en-pl" } } }, - "Amount Discount with Formula": { + "Amount Discount": { "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", + "category": "Existing Customers", "discount": { + "amount_off": 2000, "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 + "effect": "APPLY_TO_ITEMS" }, - "metadata": { - "Season": "Spring" - } + "start_date": "2021-01-01T00:00:00Z" } }, - "Percent Discount with Formula": { + "Fixed Discount": { "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", + "category": "Existing Customers", "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 + "type": "FIXED", + "fixed_amount": 2000, + "effect": "APPLY_TO_ITEMS" }, - "metadata": { - "Season": "Fall" + "start_date": "2021-01-01T00:00:00Z" + } + }, + "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" + } + ] } } } @@ -46474,85 +41439,85 @@ }, "responses": { "200": { - "description": "Returns a voucher object if the call succeeded.", + "description": "Returns the voucher object if the update succeeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/1_obj_voucher_object" }, "examples": { - "Percentage Discount": { + "Percent Discount": { "value": { - "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "code": "welcome", + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", "campaign": null, "campaign_id": null, - "category": "New Customers", + "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", - "percent_off": 10, + "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": "2022-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", + "start_date": "2020-02-01T00:00:00.000Z", + "expiration_date": "2023-12-31T23:59:59.000Z", "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" + "interval": "P3D", + "duration": "PT2H" }, "validity_day_of_week": [ + 0, 1, - 2, - 3, - 4, - 5 + 2 ], "active": false, - "additional_info": "This voucher will remain inactive until enabled.", + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", "metadata": { - "test": true, - "locale": "de-en" + "Season": "Winter" }, "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" + "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": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz%2FZTnXUFeHeehtK4L6RTvNgVeSR%2BMcTZR4DYNLEGydZ%2BFo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO%2FOEAjvVoiEuaHA%3D%3D" + "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-02-17T09:05:34.668Z", - "updated_at": null, + "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": [ - { - "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 + "data": [], + "total": 0 }, "redemption": { - "quantity": 10, + "quantity": 101, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/welcome/publications?page=1&limit=10" + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" }, "object": "voucher" } @@ -46563,24 +41528,24 @@ "code": "welcomegiftcard", "campaign": null, "campaign_id": null, - "category": "New Customers", + "category": "Existing Customers", "type": "GIFT_VOUCHER", "discount": null, "gift": { - "amount": 10000, - "balance": 10000, - "effect": "APPLY_TO_ORDER" + "amount": 20000, + "balance": 20000, + "effect": "APPLY_TO_ITEMS" }, "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", + "start_date": "2021-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.", + "active": false, + "additional_info": "This gift card is disabled.", "metadata": { - "test": true, - "locale": "de-en" + "test": false, + "locale": "de-en-pl" }, "assets": { "qr": { @@ -46594,7 +41559,13 @@ }, "is_referral_code": false, "created_at": "2022-02-17T09:09:49.665Z", - "updated_at": null, + "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, @@ -46616,23 +41587,23 @@ "code": "welcomeloyalty", "campaign": "Loyalty Campaign", "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "New Customers", + "category": "Existing Customers", "type": "LOYALTY_CARD", "discount": null, "gift": null, "loyalty_card": { - "points": 10000, - "balance": 10000 + "points": 20000, + "balance": 20000 }, "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.", + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", "metadata": { - "test": true, - "locale": "de-en" + "test": false, + "locale": "de-en-pl" }, "assets": { "qr": { @@ -46646,7 +41617,13 @@ }, "is_referral_code": false, "created_at": "2022-02-17T09:12:01.428Z", - "updated_at": null, + "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, @@ -46662,33 +41639,22 @@ "object": "voucher" } }, - "Amount Discount with Formula": { + "Amount Discount": { "value": { - "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", - "code": "amount1", + "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", + "code": "WelcomeDiscountAmount", "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" - } - ], + "category": "Existing Customers", "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" + "amount_off": 2000, + "effect": "APPLY_TO_ITEMS" }, "gift": null, "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", + "start_date": "2021-01-01T00:00:00.000Z", "expiration_date": "2022-12-31T23:59:59.000Z", "validity_timeframe": { "interval": "P2D", @@ -46701,62 +41667,132 @@ 4, 5 ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", "metadata": { - "Season": "Spring" + "test": true, + "locale": "de-en" }, "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" + "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+X2OimwSCEmGvGrZXXK+b4OrStQELVsHRup8Su+uISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6/GK/4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8/hdaq2FCQeWA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BX2OimwSCEmGvGrZXXK%2Bb4OrStQELVsHRup8Su%2BuISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6%2FGK%2F4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8%2Fhdaq2FCQeWA%3D%3D" + "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-09-19T14:22:50.552Z", - "updated_at": null, + "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": 100, + "quantity": 10, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" + "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/amount1/publications?page=1&limit=10" + "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" }, "object": "voucher" } }, - "Percent Discount with Formula": { + "Fixed Discount": { "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", + "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": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], + "category": "New Customers", "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" + "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, @@ -46767,37 +41803,47 @@ "duration": "PT1H" }, "validity_day_of_week": [ - 0, - 1 + 1, + 2, + 3, + 4, + 5 ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", "metadata": { - "Season": "Fall" + "test": true, + "locale": "de-en" }, "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" + "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/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + "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-09-19T14:41:30.976Z", - "updated_at": null, + "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": 101, + "quantity": 5, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" }, "object": "voucher" } @@ -46806,22 +41852,72 @@ } } }, - "409": { - "description": "Returns an error if a voucher code already exists.", + "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_409_duplicate_found" + "$ref": "#/components/schemas/e_error_no_translation" }, "examples": { - "Duplicate Code": { + "Invalid Voucher": { "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated voucher exists with id CODE", - "request_id": "v-0ae786a8f786b73dfa", - "resource_id": "CODE", + "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" } } @@ -46830,16 +41926,14 @@ } } } - } - }, - "/v1/vouchers/": { + }, "post": { - "operationId": "generate-random-code", + "operationId": "create-voucher", "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.", + "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": [ { @@ -46852,21 +41946,19 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_req_vouchers__POST" + "$ref": "#/components/schemas/1_req_vouchers_code_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", + "start_date": "2022-01-01T00:00:00Z", "expiration_date": "2022-12-31T23:59:59Z", "validity_timeframe": { "duration": "PT1H", @@ -46907,12 +41999,6 @@ "metadata": { "test": true, "locale": "de-en" - }, - "code_config": { - "pattern": "GIFT-CARD-##########", - "prefix": "New-", - "postfix": "0", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" } } }, @@ -46928,35 +42014,18 @@ "metadata": { "test": true, "locale": "de-en" - }, - "code_config": { - "pattern": "LOYALTY-CARD-##", - "prefix": "New-", - "postfix": "1", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" } } }, - "Unit Discount Multiple Items": { + "Amount Discount with Formula": { "value": { - "category": "New Customers", - "code": "MultipleUnitTypesUnitDiscount", + "category": "First", "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" - } - ] + "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", @@ -46971,34 +42040,44 @@ 4, 5 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", + "active": true, + "additional_info": "This voucher can be used with other coupons.", "redemption": { - "quantity": 5 + "quantity": 100 }, "metadata": { - "test": true, - "locale": "de-en" + "Season": "Spring" } } }, - "Unit Discount Single Item": { + "Percent Discount with Formula": { "value": { - "category": "New Customers", - "code": "AddMissingItemDiscount", + "category": "First", "type": "DISCOUNT_VOUCHER", "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" + "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", - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", + "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": 3 + "quantity": 101 + }, + "metadata": { + "Season": "Fall" } } } @@ -47017,10 +42096,10 @@ "examples": { "Percentage Discount": { "value": { - "id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", - "code": "NEW-WELCOME-COUPON", - "campaign": "Bug fix", - "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", + "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "code": "welcome", + "campaign": null, + "campaign_id": null, "category": "New Customers", "type": "DISCOUNT_VOUCHER", "discount": { @@ -47030,7 +42109,7 @@ }, "gift": null, "loyalty_card": null, - "start_date": "2016-01-01T00:00:00.000Z", + "start_date": "2022-01-01T00:00:00.000Z", "expiration_date": "2022-12-31T23:59:59.000Z", "validity_timeframe": { "interval": "P2D", @@ -47051,27 +42130,27 @@ }, "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" + "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": "U2FsdGVkX1/AynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos/XWBg8zu0Kta0pA/yvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr+TGlI=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos%2FXWBg8zu0Kta0pA%2FyvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr%2BTGlI%3D" + "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-17T07:14:40.096Z", + "created_at": "2022-02-17T09:05:34.668Z", "updated_at": null, "validation_rules_assignments": { "object": "list", "data_ref": "data", "data": [ { - "id": "asgm_COu5PJAsWmAwuCqR", + "id": "asgm_74F7QZoYbUoljwQO", "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", + "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", "related_object_type": "voucher", - "created_at": "2022-02-17T07:14:40.280Z", + "created_at": "2022-02-17T09:05:34.642Z", "object": "validation_rules_assignment" } ], @@ -47081,20 +42160,20 @@ "quantity": 10, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" + "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" + "url": "/v1/vouchers/welcome/publications?page=1&limit=10" }, "object": "voucher" } }, - "Gift Voucher": { + "Gift Card": { "value": { - "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", - "code": "New-GIFT-CARD-8tqB6FcyhE0", + "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", + "code": "welcomegiftcard", "campaign": null, "campaign_id": null, "category": "New Customers", @@ -47118,36 +42197,36 @@ }, "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" + "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": "U2FsdGVkX1/UaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj+Kvjmbhb22/SVZd/xzQlUBJcv7XboJYU0=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FUaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj%2BKvjmbhb22%2FSVZd%2FxzQlUBJcv7XboJYU0%3D" + "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-17T07:49:10.834Z", + "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/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" + "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/publications?page=1&limit=10" + "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" }, "object": "voucher" } }, "Loyalty Card": { "value": { - "id": "v_tVkcOhjHCz9W7q8QnuJnTGPBR2hdaYrC", - "code": "New-LOYALTY-CARD-UC1", + "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", + "code": "welcomeloyalty", "campaign": "Loyalty Campaign", "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", "category": "New Customers", @@ -47170,55 +42249,55 @@ }, "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" + "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%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" + "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-17T08:06:41.091Z", + "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/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" + "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" + "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" }, "object": "voucher" } }, - "Unit Discount Multiple Items": { + "Amount Discount with Formula": { "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", + "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", + "code": "amount1", "campaign": null, "campaign_id": null, - "category": "New Customers", + "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": "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" - } - ] + "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, @@ -47235,85 +42314,103 @@ 4, 5 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", + "active": true, + "additional_info": "This voucher can be used with other coupons.", "metadata": { - "test": true, - "locale": "de-en" + "Season": "Spring" }, "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" + "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+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" + "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-02-18T06:27:45.619Z", + "created_at": "2022-09-19T14:22:50.552Z", "updated_at": null, "redemption": { - "quantity": 5, + "quantity": 100, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + "url": "/v1/vouchers/amount1/publications?page=1&limit=10" }, "object": "voucher" } }, - "Unit Discount Single Item": { + "Percent Discount with Formula": { "value": { - "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", - "code": "AddMissingItemDiscount", + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", "campaign": null, "campaign_id": null, - "category": "New Customers", + "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": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" + "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": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": {}, + "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": "U2FsdGVkX19Yh7LTNyOVKSXQ+ceTr023saElWAUeucwOgjTH50x1SoSF/PP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La/4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE//kfWFhs=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19Yh7LTNyOVKSXQ%2BceTr023saElWAUeucwOgjTH50x1SoSF%2FPP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La%2F4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE%2F%2FkfWFhs%3D" + "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+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" + "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-02-18T06:46:44.536Z", + "created_at": "2022-09-19T14:41:30.976Z", "updated_at": null, "redemption": { - "quantity": 3, + "quantity": 101, "redeemed_quantity": 0, "object": "list", - "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" }, "publish": { "object": "list", "count": 0, - "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" }, "object": "voucher" } @@ -47321,6 +42418,29 @@ } } } + }, + "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" + } + } + } + } + } } } } @@ -47698,7 +42818,7 @@ } ], "get": { - "operationId": "list-gift-card-transactions", + "operationId": "list-voucher-transactions", "tags": [ "VOUCHERS API" ], @@ -47716,15 +42836,15 @@ "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", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_res_vouchers_code_transactions" + "$ref": "#/components/schemas/vouchers_list_vouchers_transactions_response_body" }, "examples": { "Example": { @@ -47996,7 +43116,7 @@ } ], "post": { - "operationId": "export-gift-card-transactions", + "operationId": "export-voucher-transactions", "tags": [ "VOUCHERS API" ], @@ -48007,14 +43127,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`
- `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": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" + "$ref": "#/components/schemas/vouchers_export_transactions_request_body" }, "examples": { "Example": { @@ -48047,7 +43167,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_obj_export_transactions_object" + "$ref": "#/components/schemas/voucher_transactions_export" }, "examples": { "Example": { @@ -52810,7 +47930,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" + "$ref": "#/components/schemas/PromotionsStacksListResponseBody" }, "examples": { "Example": { @@ -52996,7 +48116,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" + "$ref": "#/components/schemas/PromotionsStacksListInCampaignResponseBody" }, "examples": { "Example": { @@ -53061,7 +48181,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" + "$ref": "#/components/schemas/PromotionsStacksCreateInCampaignRequestBody" }, "examples": { "Example": { @@ -53087,7 +48207,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" + "$ref": "#/components/schemas/PromotionsStacksCreateInCampaignResponseBody" }, "examples": { "Example": { @@ -53191,7 +48311,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" + "$ref": "#/components/schemas/PromotionStack" }, "examples": { "Example": { @@ -53269,7 +48389,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" + "$ref": "#/components/schemas/PromotionsStacksUpdateRequestBody" }, "examples": { "Example": { @@ -53294,7 +48414,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" + "$ref": "#/components/schemas/PromotionsStacksUpdateResponseBody" }, "examples": { "Example": { @@ -54051,7 +49171,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_res_list_reward_assignments" + "$ref": "#/components/schemas/rewards_list_assignments_response_body" }, "examples": { "Example": { @@ -54139,7 +49259,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_req_create_reward_assignment" + "$ref": "#/components/schemas/rewards_create_assignment_request_body" }, "examples": { "Example": { @@ -54162,7 +49282,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "$ref": "#/components/schemas/reward_assignment" }, "examples": { "Example": { @@ -54308,7 +49428,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_req_update_reward_assignment" + "$ref": "#/components/schemas/rewards_update_assignment_request_body" }, "examples": { "Example": { @@ -54330,7 +49450,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "$ref": "#/components/schemas/reward_assignment" }, "examples": { "Example": { @@ -54452,7 +49572,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "$ref": "#/components/schemas/reward_assignment" } } } @@ -67773,7 +62893,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" + "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" }, "examples": { "Add points": { @@ -67798,7 +62918,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" + "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" }, "examples": { "Add balance": { @@ -67887,7 +63007,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" + "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" }, "examples": { "Subtract points": { @@ -67912,7 +63032,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" + "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" }, "examples": { "Subtract Points": { @@ -67996,7 +63116,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_transfer_loyalty_points" + "$ref": "#/components/schemas/LoyaltiesTransferPointsRequestBody" }, "examples": { "Example": { @@ -68021,7 +63141,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + "$ref": "#/components/schemas/LoyaltiesTransferPointsResponseBody" }, "examples": { "Example": { @@ -68133,7 +63253,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" }, "examples": { "Example": { @@ -68474,7 +63594,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" }, "examples": { "Example": { @@ -68807,7 +63927,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" + "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" }, "examples": { "Example": { @@ -68840,7 +63960,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" + "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" }, "examples": { "Example": { @@ -68973,7 +64093,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" + "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" }, "examples": { "Example": { @@ -69006,7 +64126,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" + "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" }, "examples": { "Example": { @@ -71880,7 +67000,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_list_member_rewards" + "$ref": "#/components/schemas/LoyaltiesListMemberRewardsResponseBody" }, "examples": { "Example": { @@ -72723,7 +67843,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "$ref": "#/components/schemas/reward_assignment" }, "examples": { "Example": { @@ -72820,7 +67940,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_req_update_reward_assignment" + "$ref": "#/components/schemas/rewards_update_assignment_request_body" }, "examples": { "Example": { @@ -74943,7 +70063,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltyTier" + "$ref": "#/components/schemas/LoyaltiesGetTierResponseBody" }, "examples": { "Example": { @@ -75763,7 +70883,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_tier_rewards" + "$ref": "#/components/schemas/loyalties_list_loyalty_tier_rewards_response_body" }, "examples": { "Example": { @@ -81010,7 +76130,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "$ref": "#/components/schemas/validation_rule_assignment" } } } @@ -81791,7 +76911,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": { @@ -81837,7 +76957,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": { @@ -81963,7 +77083,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": { @@ -82060,7 +77180,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "$ref": "#/components/schemas/validation_rule_assignment" }, "examples": { "Example": { @@ -83638,7 +78758,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": [ { @@ -83651,7 +78771,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/16_req_create_export_POST" + "$ref": "#/components/schemas/ExportsCreateRequestBody" } } } @@ -83662,7 +78782,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/16_obj_export_object" + "$ref": "#/components/schemas/ExportsCreateResponseBody" } } } @@ -83747,7 +78867,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/16_res_list_exports" + "$ref": "#/components/schemas/ExportsListResponseBody" }, "examples": { "List Exports": { @@ -83872,7 +78992,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/16_obj_export_object" + "$ref": "#/components/schemas/ExportsGetResponseBody" }, "examples": { "Get Export": { @@ -84073,7 +79193,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } } } @@ -84102,7 +79222,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_res_list_categories" + "$ref": "#/components/schemas/CategoriesListResponseBody" }, "examples": { "Example": { @@ -84181,7 +79301,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_req_create_category" + "$ref": "#/components/schemas/CategoriesCreateRequestBody" }, "examples": { "Example": { @@ -84200,7 +79320,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_res_create_category" + "$ref": "#/components/schemas/CategoriesCreateResponseBody" }, "examples": { "Example": { @@ -84281,7 +79401,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/CategoriesGetResponseBody" }, "examples": { "Example": { @@ -84361,7 +79481,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_req_update_categories_categoryId" + "$ref": "#/components/schemas/CategoriesUpdateRequestBody" }, "examples": { "Example": { @@ -84380,7 +79500,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/CategoriesUpdateResponseBody" }, "examples": { "Example": { @@ -85891,4 +81011,4 @@ } } } -} \ No newline at end of file +} diff --git a/scripts/helpers/getFiles.ts b/scripts/helpers/getFiles.ts new file mode 100644 index 000000000..82a16fde1 --- /dev/null +++ b/scripts/helpers/getFiles.ts @@ -0,0 +1,24 @@ +import fsPromises from "fs/promises"; + +export const getFiles = async ( + path: string, + skipDirectoryNames: string[] = [] +) => { + const pathsToFiles: string[] = []; + const items = await fsPromises.readdir(path, { + withFileTypes: true, + }); + for (const item of items) { + const itemPath = path + `/${item.name}`; + if (item.isDirectory() && !skipDirectoryNames.includes(item.name)) { + (await getFiles(itemPath, skipDirectoryNames)).forEach((value) => { + pathsToFiles.push(value); + }); + continue; + } + if (!item.isDirectory()) { + pathsToFiles.push(itemPath); + } + } + return pathsToFiles; +}; diff --git a/scripts/manage-project.ts b/scripts/manage-project.ts index 4002e5099..a245f18cc 100644 --- a/scripts/manage-project.ts +++ b/scripts/manage-project.ts @@ -36,24 +36,17 @@ const main = async ({ create?: boolean; update?: boolean; }) => { - const valid = validateOptions({ help, version, create, update }); - if (!valid) { + if (!(await validate({ help, version, create, update }))) { return; } if (create) { await createNewVersion(version); - } else if (!(await isVersionExists(version))) { - console.log( - colors.red( - `Version ${version} does not exist! Create it first. Use parameter --update instead of --create` - ) - ); - return; } await cleanProject(version); await uploadOpenApiFile(version); await buildMdTables(); await updateMdTablesInDocs(); + await uploadImagesUsedInMdFiles(); await uploadGuideFiles(version); await uploadReferenceDocsWithMaxNumberOfAttempts(version); console.log( @@ -61,6 +54,18 @@ const main = async ({ ); }; +const uploadImagesUsedInMdFiles = async () => { + console.log( + colors.green( + "LOOKING FOR NOT UPLOADED IMAGES IN MD FILES, UPLOADING IF NEEDED..." + ) + ); + await runCliProcess({ + command: `npm run readme-upload-missing-images`, + }); + console.log(colors.green("OPERATION WAS COMPLETED SUCCESSFULLY!")); +}; + const isVersionExists = async (version: string) => { return ( ( @@ -80,12 +85,12 @@ 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)); - const success = await runCliProcess({ + await new Promise((r) => setTimeout(r, 10000)); + const { success, error } = await runCliProcess({ command: `rdme docs ./docs/reference-docs --version=${version}`, stdoutIncludes: "successfully created", resolveErrorAsFalse: true, @@ -95,6 +100,7 @@ const uploadReferenceDocsWithMaxNumberOfAttempts = async ( break; } if (i === maxNumberOfUploadingAttempts) { + console.log(error); throw new Error("REFERENCE DOC FILES WERE NOT UPLOADED!"); } } @@ -111,7 +117,7 @@ const runCliProcess = async ({ stdoutIncludes?: string; stderrIncludes?: string; resolveErrorAsFalse?: boolean; -}) => { +}): Promise<{ success: boolean; error?: string }> => { return await new Promise((resolve) => { exec(command, (error, stdout, stderr) => { const stdoutClean = stdout.replace(/.*voucherify/, "").trim(); @@ -120,18 +126,19 @@ const runCliProcess = async ({ (!stdoutIncludes && stdoutClean) || (stderrIncludes && stderr.includes(stderrIncludes)) ) { - return resolve(true); + return resolve({ success: true }); } if (resolveErrorAsFalse) { - return resolve(false); + return resolve({ success: false, error: `Error: \n${stderr}` }); } if (stderr) { - console.log(stderr); + console.log(`Error: \n${stderr}`); } throw error; }); }); }; + const uploadGuideFiles = async (version) => { console.log(colors.green("UPLOADING GUIDES DOC FILES...")); await runCliProcess({ @@ -170,7 +177,7 @@ const uploadOpenApiFile = async (version) => { }; const createNewVersion = async (version) => { - //create fork + console.log(colors.green("CREATING NEW VERSION")); try { const response = await fetch(`https://dash.readme.com/api/v1/version`, { method: "POST", @@ -188,7 +195,7 @@ const createNewVersion = async (version) => { version, }), }); - if (response.status !== 200) { + if (response.status !== 200 && !(await isVersionExists(version))) { throw new Error( `Response status: ${response.status}, maybe this versionTag is already created?` ); @@ -230,7 +237,9 @@ 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; @@ -315,7 +324,7 @@ const asyncMap = (arr, asyncFn) => { return Promise.all(arr.map(asyncFn)); }; -const validateOptions = ({ +const validate = async ({ help, version, create, @@ -326,6 +335,12 @@ const validateOptions = ({ create?: boolean; update?: boolean; }) => { + if (process.env.README_IO_AUTH?.length < 10) { + console.log( + colors.red("`README_IO_AUTH` was not provided in `.env` file :/") + ); + return; + } if (help || (!version && !create && !update)) { printHelp(); return false; @@ -354,6 +369,22 @@ const validateOptions = ({ ); return false; } + if (update && !(await isVersionExists(version))) { + console.log( + colors.red( + `Version ${version} does not exist! Create it first. Use parameter --create instead of --update` + ) + ); + return false; + } + if (create && (await isVersionExists(version))) { + console.log( + colors.red( + `Version ${version} already exist! Update it instead. Use parameter --update instead of --create` + ) + ); + return false; + } return true; }; 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'], diff --git a/scripts/readme-fix-reference-docs.ts b/scripts/readme-fix-reference-docs.ts index ef6c0a1a8..aa949b2d4 100644 --- a/scripts/readme-fix-reference-docs.ts +++ b/scripts/readme-fix-reference-docs.ts @@ -1,7 +1,8 @@ -import * as fsPromises from 'fs/promises' -import path from 'path'; -import dotenv from 'dotenv' -import minimist from 'minimist'; +import * as fsPromises from "fs/promises"; +import path from "path"; +import dotenv from "dotenv"; +import minimist from "minimist"; +import { getFiles } from "./helpers/getFiles"; dotenv.config(); const { version } = minimist(process.argv.slice(2)); @@ -9,7 +10,7 @@ const { version } = minimist(process.argv.slice(2)); const readmeFixReferenceDocs = async () => { if (!version) { console.log( - "`version` argument was not provided :/, next time try add `-- --version=************` at the end of file execution command" + "`version` argument was not provided :/, next time try add `-- --version=************` at the end of file execution command" ); return; } @@ -18,15 +19,16 @@ const readmeFixReferenceDocs = async () => { return; } const basePath = path.join(__dirname, "../docs"); - const pathsToFiles = await getFiles(basePath); - + const pathsToFiles = (await getFiles(basePath, [".bin"])).filter((filePath) => + filePath.endsWith(".md") + ); const dataToProcess = []; for (const pathToFile of pathsToFiles) { const data = await fsPromises.readFile(pathToFile, { encoding: "utf8" }); const slug = data.match(/slug: .*/)?.[0]?.split?.("slug: ")?.[1]; const type = data.match(/type: .*/)?.[0]?.split?.("type: ")?.[1]; const order = parseInt( - data.match(/order: .*/)?.[0]?.split?.("order: ")?.[1] + data.match(/order: .*/)?.[0]?.split?.("order: ")?.[1] ); if (!slug || isNaN(order)) { throw new Error("Invalid slug or order in " + pathToFile); @@ -51,7 +53,7 @@ const updateDoc = async ({ slug, order, type, pathToFile }) => { body: JSON.stringify({ order, type }), }; - try{ + try { const response = await fetch( `https://dash.readme.com/api/v1/docs/${slug}`, options @@ -60,7 +62,9 @@ const updateDoc = async ({ slug, order, type, pathToFile }) => { const responseJSON = await response.json(); if (responseJSON.error) { - console.log(`Error in json response from readme for ${slug}`, { responseJSON }); + console.log(`Error in json response from readme for ${slug}`, { + responseJSON, + }); throw new Error(responseJSON.error); } @@ -71,9 +75,9 @@ const updateDoc = async ({ slug, order, type, pathToFile }) => { } return responseJSON; - }catch(error){ + } catch (error) { console.log(`Error when reqesting readme for ${slug}`, error); - throw new Error(error) + throw new Error(error); } }; @@ -82,30 +86,8 @@ const chunkArray = (list, chunkSize) => list.splice(0, chunkSize) ); -const getFiles = async (path: string) => { - const pathsToFiles: string[] = []; - const items = await fsPromises.readdir(path, { - withFileTypes: true, - }); - for (const item of items) { - const itemPath = path + `/${item.name}`; - if (item.isDirectory() && !itemPath.endsWith(".bin")) { - (await getFiles(itemPath)).forEach((value) => { - pathsToFiles.push(value); - }); - continue; - } - if (itemPath.endsWith(".md")) { - pathsToFiles.push(itemPath); - } - } - return pathsToFiles; -}; - const asyncMap = (arr, asyncFn) => { return Promise.all(arr.map(asyncFn)); }; - - -readmeFixReferenceDocs() +readmeFixReferenceDocs(); diff --git a/scripts/readme-upload-missing-images.ts b/scripts/readme-upload-missing-images.ts new file mode 100644 index 000000000..f0600b8c2 --- /dev/null +++ b/scripts/readme-upload-missing-images.ts @@ -0,0 +1,93 @@ +import * as fsPromises from "fs/promises"; +import * as fs from "fs"; +import path from "path"; +import axios from "axios"; +import FormData from "form-data"; +import { getFiles } from "./helpers/getFiles"; + +const readmeUploadMissingImages = async () => { + if (process.env.README_IO_AUTH?.length < 10) { + console.log("`README_IO_AUTH` was not provided in `.env` file :/"); + return; + } + const basePath = path.join(__dirname, "../docs"); + const pathsToFiles = (await getFiles(basePath, [".bin"])).filter((filePath) => + filePath.endsWith(".md") + ); + for (const pathToFile of pathsToFiles) { + const fileData = await fsPromises.readFile(pathToFile, { + encoding: "utf8", + }); + const matchIterator: any = fileData.matchAll(/\.\.\/\.\.\/assets.*/g); + let match = matchIterator.next(); + const matches = []; + while (match.value) { + // found asset + matches.push(match); + match = matchIterator.next(); + } + if (!matches.length) { + // not found any assets + continue; + } + let newFileContent = `${fileData}`; + while (matches.length) { + // looping through matches, start from the last one - `pop` is required! + const { value } = matches.pop(); + const matchedString = value[0]; + if (matchedString.includes("-->")) { + // skip if match found in comment + continue; + } + const matchedIndex = value.index; + const pathToAsset = matchedString.match(/\.\.\/\.\.\/assets[^" )]+/)?.[0]; + if (!pathToAsset) { + // this should be impossible + throw `Path to asset not found :/ problem in file: ${pathToFile}`; + } + const absolutePathToAsset = path.join( + __dirname, + "../docs", + pathToAsset.replaceAll("../", "") + ); + const urlToFile = await uploadImageToReadme(absolutePathToAsset); + console.log(`Image uploaded, doc file: ${pathToFile}`); + // texts + const textToReplaceWithMatchedString = matchedString.replace( + pathToAsset, + urlToFile + ); + newFileContent = + newFileContent.slice(0, matchedIndex) + + textToReplaceWithMatchedString + + newFileContent.slice(matchedIndex + matchedString.length); + } + if (newFileContent === fileData) { + continue; + } + await fsPromises.writeFile(pathToFile, newFileContent); + } + console.log("Done!"); +}; + +const uploadImageToReadme = async (pathToFile) => { + const fileStream = fs.createReadStream(pathToFile); + const form = new FormData(); + // Pass file stream directly to form + form.append("file", fileStream); + const response = await axios.post( + "https://dash.readme.com/api/images/image-upload", + form, + { + headers: { + authorization: "Basic " + btoa(process.env.README_IO_AUTH + ":"), + }, + } + ); + if (response.status !== 200 || !response?.data?.[0]) { + throw response; + } + return response.data[0]; +}; + +readmeUploadMissingImages(); diff --git a/tsconfig.json b/tsconfig.json index 8f59f43be..67950e0e5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "resolveJsonModule": true, - "esModuleInterop": true + "esModuleInterop": true, + "lib": ["es2017", "dom"] } -} \ No newline at end of file +}