diff --git a/Changelog.md b/Changelog.md index f88aaa701..a1c6c789b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,21 +21,22 @@ #### Schemas changes - GET /v1/loyalties/{campaignId}/tiers - - new response schema `LoyaltiesListTiersResponseBody` (old `8_res_list_loyalty_tiers`) + - new response schema `LoyaltiesListTiersResponseBody` (old `8_res_list_loyalty_tiers`) - GET /v1/loyalties/members/{memberId}/balance - - new response schema `LoyaltiesGetRewardAssignmentResponseBody` (old `4_obj_reward_assignment_object`) + - new response schema `LoyaltiesGetRewardAssignmentResponseBody` (old `4_obj_reward_assignment_object`) - GET /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward - - new response schema `LoyaltiesGetRewardDetailsResponseBody` (old `4_obj_reward_object`) + - new response schema `LoyaltiesGetRewardDetailsResponseBody` (old `4_obj_reward_object`) - GET /v1/loyalties/{campaignId}/tiers/{tierId} - - new response schema `LoyaltiesGetTierResponseBody` (old `8_obj_loyalty_tier_object`) + - new response schema `LoyaltiesGetTierResponseBody` (old `8_obj_loyalty_tier_object`) - GET /v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules - - new response schema `LoyaltiesListLoyaltyTierEarningRulesRequestQuery` (old `8_res_list_loyalty_tier_earning_rules`) + - new response schema `LoyaltiesListLoyaltyTierEarningRulesRequestQuery` (old `8_res_list_loyalty_tier_earning_rules`) - GET /v1/loyalties/members/{memberId}/tiers - - new response schema `LoyaltiesListMemberLoyaltyTiersResponseBody` (old `8_res_get_member_loyalty_tier`) + - new response schema `LoyaltiesListMemberLoyaltyTiersResponseBody` (old `8_res_get_member_loyalty_tier`) #### New endpoint - POST /v1/loyalties/{campaignId}/tiers + ## 20231009 #### New schemas: @@ -87,6 +88,58 @@ - /v1/loyalties/{campaignId}/members/{memberId}/points-expiration - new response schema `LoyaltiesGetPointsExpirationResponseBody` (old `8_res_get_points_expiration`) +## 20230831 - Exports API + +**New models** +- ExportsCreateRequestBody +- ExportBase +- Export +- ExportsCreateResponseBody +- ExportVoucher +- FieldConditions +- FiltersCondition +- ExportVoucherFilters +- Junction +- ExportRedemption +- ExportRedemptionFilters +- ExportCustomer +- ExportCustomerFilters +- ExportPublication +- ExportPublicationFilters +- ExportOrder +- ExportOrderFilters +- ExportPointsExpiration +- ExportPointsExpirationFilters +- ExportVoucherTransactionsExpiration +- ExportVoucherTransactionsFilters +- ExportsGetResponseBody +- ExportsListResponseBody +- ExportCustomerFields +- ExportCustomerOrder +- ExportPublicationFields +- ExportPublicationOrder +- ExportRedemptionFields +- ExportRedemptionOrder +- ExportVoucherFields +- ExportVoucherOrder +- ExportOrderFields +- ExportOrderOrder +- ExportPointsExpirationFields +- ExportPointsExpirationOrder +- ExportVoucherTransactionsFields +- ExportVoucherTransactionsOrder +- Any + +**Endpoint changes** +- v1/exports + - POST + - New request schema: `ExportsCreateRequestBody` + - New response schema: `ExportsCreateResponseBody` + - GET + - New response schema: `ExportsListResponseBody` +- v1/exports/{exportId} + - GET + - New response schema: `ExportsGetResponseBody` ## 20231005 - Earning rule diff --git a/docs/reference-docs/EXPORTS-API-Export-Object.md b/docs/reference-docs/EXPORTS-API-Export-Object.md index 4d8d379a5..204062922 100644 --- a/docs/reference-docs/EXPORTS-API-Export-Object.md +++ b/docs/reference-docs/EXPORTS-API-Export-Object.md @@ -8,214 +8,302 @@ hidden: false order: 1 --- -## Export Object -| Attributes | Description | -|:-----|:--------| -| id
`string` |

Unique export ID.

**Example:**

exp_FFfp9o7daWuJqJCKp5xqqli4

| -| object
`string` |

The type of object being represented. This object stores information about the export.

| -| created_at
`string` |

Timestamp representing the date and time when the export was scheduled in ISO 8601 format.

**Example:**

2022-04-28T11:23:20.922Z

| -| status
`string` |

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.

Available values: `SCHEDULED`, `IN_PROGRESS`, `DONE`, `ERROR` | -| channel
`string` |

The channel through which the export was triggered.

Available values: `API`, `WEBSITE` | -| exported_object
`string` |

The type of exported object.

Available values: `order`, `voucher`, `publication`, `redemption`, `customer`, `points_expiration`, `voucher_transactions` | -| parameters | Any of: [order](#order), [voucher](#voucher), [publication](#publication), [redemption](#redemption), [customer](#customer), [points expiration](#points-expiration), [gift card transactions](#gift-card-transactions), [loyalty card transactions](#loyalty-card-transactions) | -| result
`object` |

Contains the URL of the CSV file.

AttributesDescription
url
string

URL of the CSV file location. It contains the token used for authorization in the Download export method.

| -| user_id
`string` |

Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.

**Example:**

user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH

| - -## order -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `-created_at`, `created_at`, `updated_at`, `-updated_at`, `status`, `-status` | -| fields
`array` |

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:

FieldDefinitionExample Export
idUnique order ID.ord_A69RIxEdRsPuC6i8gFGVHUft
source_idUnique order source ID.8638
created_atTimestamp in ISO 8601 format representing the date and time when the order was created.2022-03-09T09:16:32.521Z
updated_atTimestamp in ISO 8601 format representing the date and time when the order was last updated.2022-03-09T09:16:33.331Z
statusOrder status.PAID, CREATED, FULFILLED, CANCELED
amountTotal amount of order items.7700
discount_amountRepresents total amount of the discount applied to whole cart.500
items_discount_amountRepresents total amount of the discount applied to order line items.100
total_discount_amountAll discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart.600
total_amountTotal order amount after applying all discounts.7100
customer_idCustomer unique ID.cust_2G4fUQdCXUqp35nXNleav7bO
referrer_idReferrer unique ID.cust_IkrTR674vvQvr9a4rDMiqglY
metadataReturns all order metadata.Response will include all order metadata.
metadata.XWhere X is the name of a particular order metadata property.The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. Read more here.
Available values: `id,source_id,created_at,updated_at,status,amount,discount_amount,items_discount_amount,total_discount_amount,total_amount,customer_id,referrer_id,metadata` | -| filters | Any of: [Filter by status](#filter-by-status), [Filter by order source ID](#filter-by-order-source-id), [Filter by order amount](#filter-by-order-amount), [Filter by order total amount](#filter-by-order-total-amount), [Filter by order discount amount](#filter-by-order-discount-amount), [Filter by order total discount amount](#filter-by-order-total-discount-amount), [Filter by order items discount amount](#filter-by-order-items-discount-amount) | - -## voucher -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `created_at`, `-created_at`, `updated_at`, `-updated_at`, `code`, `-code` | -| fields
`array` |

Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:

FieldDefinitionExample Export
idUnique voucher ID.v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD
codeUnique voucher code.WELCOME100
voucher_typeType of voucher.DISCOUNT_VOUCHER, GIFT_VOUCHER, LOYALTY_CARD
valueValue of voucher.DISCOUNT_VOUCHER : amount, percent, unit
GIFT_VOUCHER: amount left to spend
LOYALTY_CARD: available usable points
discount_typeThe type of discount for a DISCOUNT_VOUCHER.AMOUNT, PERCENT, UNIT, FIXED
campaignUnique campaign name.Summer Discounts 20% off
categoryTag defining the category that this voucher belongs to.
start_dateStart 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
expiration_dateExpiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is inactive after this date.2023-12-31T23:00:00.000Z
gift_balanceAmount left to spend.1000
loyalty_balanceAvailable usable points.2000
redemption_quantityMaximum number of times a voucher can be redeemed.2
redemption_countTotal redemptions.59
activeBoolean indicating whether the voucher is available for use.true, false
qr_codeURL to QR representation of encrypted code.
bar_codeURL to barcode representation of encrypted code.
is_referral_codeBoolean indicating whether the voucher is a referral code.true, false
created_atTimestamp in ISO 8601 format representing the date and time when the voucher was created.2022-04-14T09:55:46.814Z
updated_atTimestamp in ISO 8601 format representing the date and time when the voucher was last updated.2022-04-14T10:02:18.036Z
validity_timeframe_intervalDefines 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
validity_timeframe_durationDefines 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
validity_day_of_weekArray corresponding to the particular days of the week in which the voucher is valid."1,2,3,4,5"
discount_amount_limitFor PERCENT discount type, this is the maximum threshold allowed to be deducted.50
campaign_idParent campaign ID.camp_7s3uXI44aKfIk5IhmeOPr6ic
additional_infoAn optional field to keep any extra textual information about the code such as a code description and details.
customer_idUnique customer ID of the assigned owner to whom the voucher was published.cust_7iUa6ICKyU6gH40dBU25kQU1
discount_unit_typeFor UNIT discount type, either a shipping or product ID for a UNIT discount with one product.prod_5h1pp1ng, prod_0a9f9aeddb019a42db
discount_unit_effectUNIT discount effect.ADD_MANY_ITEMS, ADD_MISSING_ITEMS,ADD_NEW_ITEMS
customer_source_idUnique customer source id of the assigned owner to whom the voucher was published.name.lastname@email.com
metadataReturns all voucher metadata.Response will include all voucher metadata.
metadata.XWhere X is the name of a particular voucher metadata property.The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Voucher. Read more here.
Available values: `code,voucher_type,value,discount_type,campaign,category,start_date,expiration_date,gift_balance,loyalty_balance,redemption_quantity,redemption_count,active,qr_code,bar_code,id,is_referral_code,created_at,updated_at,validity_timeframe_interval,validity_timeframe_duration,validity_day_of_week,discount_amount_limit,campaign_id,additional_info,customer_id,discount_unit_type,discount_unit_effect,customer_source_id,metadata` | -| filters
`object` |

Data filters used to narrow the data records to be returned in the export. You can filter the following parameters:

| - -## publication -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `id`, `-id`, `voucher_code`, `-voucher_code`, `tracking_id`, `-tracking_id`, `customer_id`, `-customer_id`, `created_at`, `-created_at`, `channel`, `-channel` | -| fields
`array` |

Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:

FieldDefinitionExample Export
voucher_codeUnique voucher code.WELCOME100
customer_idCustomer unique ID.cust_7iUa6ICKyU6gH40dBU25kQU1
customer_source_idUnique customer source id of the assigned owner to whom the voucher was published.name.lastname@email.com
dateTimestamp in ISO 8601 format representing the date and time when the voucher was published.2022-04-28T10:19:30.792Z
channelPublication channel.voucherify-website
campaignUnique campaign name.Summer Discounts 20% off
is_winner
metadataReturns all publication metadata.Response will include all publication metadata.
metadata.XWhere X is the name of a particular publication metadata property.The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Publication. Read more here
Available values: `voucher_code,customer_id,customer_source_id,date,channel,campaign,is_winner,metadata` | -| filters |

Data filters used to narrow the data records to be returned in the export. You can filter the following parameters:

Any of: [Filter by failure code](#filter-by-failure-code), [Filter by result](#filter-by-result), [Filter by customer ID](#filter-by-customer-id), [Filter by campaign name](#filter-by-campaign-name), [Filter by voucher type](#filter-by-voucher-type), [Filter if the code is a referral code](#filter-if-the-code-is-a-referral-code), [Filter by parent object ID](#filter-by-parent-object-id), [Filter by related object ID](#filter-by-related-object-id), [Filter by publication source ID](#filter-by-publication-source-id) | - -## redemption -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `id`, `-id`, `voucher_code`, `-voucher_code`, `tracking_id`, `-tracking_id`, `customer_id`, `-customer_id`, `created_at`, `-created_at` | -| fields
`array` |

Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:

FieldDefinitionExample Export
idUnique redemption ID.r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8
objectObject being exported; by default redemption.redemption
dateTimestamp in ISO 8601 format representing the date and time when the voucher was redeemed.2022-03-23T08:52:24.867Z
voucher_codeUnique voucher code redeemed.WELCOME100
campaignParent campaign name of voucher if applicable.Summer Discounts 20% off
promotion_tier_idpromo_Mwy9XpA0TLctSGriM5kum0qp
customer_idUnique customer ID of redeeming customer.cust_nk0N1uNQ1YnupAoJGOgvsODC
customer_source_idUnique source ID of redeeming customer.name.lastname@email.com
customer_nameCustomer name.John Smith
tracking_idtrack_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy
order_amountTotal order amount before applying all discounts.1000
gift_amountGift credits used for redemption.10
loyalty_points12
resultTells you whether the redemption succeeded.SUCCESS, FAILURE
failure_codeInternal Voucherify code for reason why redemption failed.invalid_customer
failure_messageA human-readable message providing a short description explaining why the redemption failed.Customer must be a holder of a loyalty card.
metadataReturns all redemption metadata.Response will include all redemption metadata.
metadata.XWhere X is the name of a particular redemption metadata property.The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Redemption. Read more here
Available values: `id,object,date,voucher_code,campaign,promotion_tier_id,customer_id,customer_source_id,customer_name,tracking_id,order_amount,gift_amount,loyalty_points,result,failure_code,failure_message,metadata` | -| filters
`object` |

Data filters used to narrow the data records to be returned in the export. You can filter the following parameters:

| - -## customer -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `name`, `-name`, `id`, `-id`, `email`, `-email`, `source_id`, `-source_id`, `created_at`, `-created_at`, `updated_at`, `-updated_at` | -| fields
`array` |

Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:

FieldDefinitionExample Export
nameCustomer name.John Smith
idUnique customer ID.cust_J1CDUdbqn5Exva8ASWk1Fq0j
descriptionAn arbitrary string that you can attach to a customer object.Customer requesting to be added to VIP tier.
emailCustomer's email.name.lastname@email.com
source_idUnique custom customer identifier.name.lastname@email.com
created_atTimestamp in ISO 8601 format representing the date and time when the customer was created.2022-02-03T13:10:11.928Z
address_cityCityHouston
address_stateStateTX
address_line_1First line of customer's address.72738 Main St
address_line_2Second line of customer's address.Bld 2, Apt 4
address_countryCountryUnited States of America
address_postal_codePostal code (ZIP code)77042-4143
redemptions_total_redeemedTotal customer redemptions.5
redemptions_total_failedTotal customer failed redemptions.2
redemptions_total_succeededTotal customer succeeded redemptions.3
redemptions_total_rolled_backTotal customer redemptions that were rolled back.3
redemptions_total_rollback_failedTotal customer redemptions that were unsuccessfully rolled back.2
redemptions_total_rollback_succeededTotal customer redemptions that were successfully rolled back.1
orders_total_amountTotal sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places.10000 (represents $100)
orders_total_countTotal number of customer orders. Value is multiplied by 100 to precisely represent 2 decimal places.2
orders_average_amountAverage amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places.50
orders_last_order_amountHow much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places.50
orders_last_order_dateWhen was the last customer order; timestamp in ISO 8601 format representing the date and time.2022-02-03T13:17:30.630Z
loyalty_pointsSum of customer's loyalty points to go across all loyalty cards.
loyalty_referred_customersHow many customers were referred by this customer.
updated_atTimestamp in ISO 8601 format representing the date and time when the customer was updated.2022-02-14T14:10:14.305Z
phoneCustomer's phone number.+1 (294) 752-1846
birthdayCustomer's birthday.2022-01-01
birthdateCustomer's birthdate.2022-04-29
metadataReturns all customer metadata.Response will include all customer metadata.
metadata.XWhere X is the name of a particular customer metadata property.The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Customer. Read more here
Available values: `name,id,description,email,source_id,created_at,address_city,address_state,address_line_1,address_line_2,address_country,address_postal_code,redemptions_total_redeemed,redemptions_total_failed,redemptions_total_succeeded,redemptions_total_rolled_back,redemptions_total_rollback_failed,redemptions_total_rollback_succeeded,orders_total_amount,orders_total_count,orders_average_amount,orders_last_order_amount,orders_last_order_date,loyalty_points,loyalty_referred_customers,updated_at,phone,birthday,metadata,birthdate` | -| filters
`object` |

Data filters used to narrow the data records to be returned in the export. You can filter the following parameters:

| - -## points expiration -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `expires_at`, `-expires_at` | -| fields
`array` |

Array of strings containing the data that was exported. These fields define the headers in the CSV file.

The array can be a combintation of any of the following available fields:

FieldDefinitionExample Export
idLoyalty points bucket ID.lopb_Wl1o3EjJIHSNjvO5BDLy4z1n
campaign_idCampaign ID of the parent loyalty campaign.camp_7s3uXI44aKfIk5IhmeOPr6ic
voucher_idVoucher ID of the parent loyalty card.v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655
statusStatus of the loyalty points bucket.ACTIVE or INACTIVE
expires_atTimestamp in ISO 8601 format representing the date when the points expire.2022-06-30
pointsNumber of points.1000
Available values: `id,campaign_id,voucher_id,status,expires_at,points` | -| filters |

Data filters used to narrow the data records to be returned in the export. You can filter the following parameters:

Any of: [Filter by campaign ID](#filter-by-campaign-id), [Filter by voucher ID](#filter-by-voucher-id) | - -## gift card transactions -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `-created_at`, `created_at` | -| fields
`array` |

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:

FieldDefinitionExample Export
idUnique transaction ID.vtx_0cb7811f1c07765800
typeTransaction type.- CREDITS_REMOVAL
- CREDITS_ADDITION
- CREDITS_REFUND
- CREDITS_REDEMPTION
source_idUnique transaction source ID.8638
reasonContains the reason for the transaction if one was included originally.
balanceThe gift card balance after the transaction.
amountThe 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.
created_atTimestamp in ISO 8601 format representing the date and time when the transaction was created.2022-03-09T09:16:32.521Z
voucher_idUnique Voucher ID.v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp
campaign_idParent campaign ID.camp_FNYR4jhqZBM9xTptxDGgeNBV
sourceChannel through which the transaction was initiated.API
detailsMore detailed information stored in the form of a JSON.Provides more details related to the transaction in the form of an object.
Available values: `id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,source,details` | -| filters | See: [Filter by voucher ID](#filter-by-voucher-id) | - -## loyalty card transactions -| Attributes | Description | -|:-----|:--------| -| order
`string` |

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

Available values: `-created_at`, `created_at` | -| fields
`array` |

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:

FieldDefinitionExample Export
idUnique transaction ID assigned by Voucherify.vtx_0cb7811f1c07765800
typeTransaction type.- POINTS_EXPIRATION
- POINTS_ADDITION
- POINTS_REMOVAL
- POINTS_TRANSFER_OUT
- POINTS_ACCRUAL
- POINTS_REFUND
- POINTS_REDEMPTION
source_idCustom source ID of the transaction if one was included originally.source_id_custom
reasonContains the reason for the transaction if one was included originally.
balanceThe loyalty card balance after the transaction.
amountThe amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction.
created_atTimestamp in ISO 8601 format representing the date and time when the transaction was created.2022-03-09T09:16:32.521Z
voucher_idUnique Voucher ID.v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp
campaign_idParent campaign ID.camp_FNYR4jhqZBM9xTptxDGgeNBV
sourceChannel through which the transaction was initiated.- API
- voucherify-web-ui
- Automation
detailsMore detailed information stored in the form of a JSON.Provides more details related to the transaction in the form of an object.
related_transaction_idUnique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card.vtx_0c9afe802593b34b80
Available values: `id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,details,related_transaction_id` | -| filters | See: [Filter by voucher ID](#filter-by-voucher-id) | - -## Filter by status -| Attributes | Description | -|:-----|:--------| -| status | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by order source ID -| Attributes | Description | -|:-----|:--------| -| source_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by order amount -| Attributes | Description | -|:-----|:--------| -| amount | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +## Export +All of: -## Filter by order total amount -| Attributes | Description | -|:-----|:--------| -| total_amount | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by order discount amount -| Attributes | Description | -|:-----|:--------| -| discount_amount | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by order total discount amount -| Attributes | Description | -|:-----|:--------| -| total_discount_amount | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by order items discount amount -| Attributes | Description | -|:-----|:--------| -| items_discount_amount | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by failure code -| Attributes | Description | -|:-----|:--------| -| failure_code | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by result -| Attributes | Description | -|:-----|:--------| -| result | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by customer ID -| Attributes | Description | -|:-----|:--------| -| customer_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by campaign name -| Attributes | Description | -|:-----|:--------| -| campaign_name | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter by voucher type -| Attributes | Description | -|:-----|:--------| -| voucher_type | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | - -## Filter if the code is a referral code -| Attributes | Description | -|:-----|:--------| -| is_referral_code | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +1. [ExportBase](#exportbase) +2. Any of: [Export Vouchers](#export-vouchers), [Export Redemptions](#export-redemptions), [Export Customers](#export-customers), [Export Publications](#export-publications), [Export Orders](#export-orders), [Export Points Expirations](#export-points-expirations), [Export Vouchers Transactions Expiration](#export-vouchers-transactions-expiration) -## Filter by parent object ID +## ExportBase | Attributes | Description | |:-----|:--------| -| parent_object_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| id
`string` |

Unique export ID.

| +| object
`string` |

The type of object being represented. This object stores information about the export.

Available values: `export` | +| created_at
`string` |

Timestamp representing the date and time when the export was scheduled in ISO 8601 format.

| +| status
`string` |

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.

Available values: `SCHEDULED`, `IN_PROGRESS`, `DONE`, `ERROR` | +| channel
`string` |

The channel through which the export was triggered.

| +| result
`object,null` |

Contains the URL of the CSV file.

| +| user_id
`string,null` |

Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE.

| -## Filter by related object ID +## Export Vouchers | Attributes | Description | |:-----|:--------| -| related_object_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `voucher` | +| parameters
`object` |
AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Voucher Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Voucher Fields
filters

Filter conditions.

See: Export Voucher Filters
| -## Filter by publication source ID +## Export Redemptions | Attributes | Description | |:-----|:--------| -| source_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `redemption` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Redemption Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Redemption Fields
filters

Filter conditions.

See: Export Redemption Filters
| -## Filter by campaign ID +## Export Customers | Attributes | Description | |:-----|:--------| -| campaign_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `customer` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Customer Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Customer Fields
filters

Filter conditions.

See: Export Customer Filters
| -## Filter by voucher ID +## Export Publications | Attributes | Description | |:-----|:--------| -| voucher_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `publication` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Publication Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Publication Fields
filters

Filter conditions.

See: Export Publication Filters
| -## Filter by voucher ID +## Export Orders | Attributes | Description | |:-----|:--------| -| voucher_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `order` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Order Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Order Fields
filters

Filter conditions.

See: Export Order Filters
| -## Filter by voucher ID +## Export Points Expirations | Attributes | Description | |:-----|:--------| -| voucher_id | See: [Filter by conditions](#filter-by-conditions) | -| junction | See: [Logical Operator Between Filters](#logical-operator-between-filters) | +| exported_object
`string` |

The type of object to be exported.

Available values: `points_expiration` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Points Expiration Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Points Expiration Fields
filters

Filter conditions.

See: Export Points Expiration Filters
| -## Filter by conditions +## Export Vouchers Transactions Expiration | Attributes | Description | |:-----|:--------| -| conditions
`object` |

Data filters used to narrow the data records to be returned in the result.

AttributesDescription
$in
array

Array of resource values that should be included in the results. (multiple values)

$not_in
array

Array of resource values that should be included in the results. (multiple values)

$is
string

Value is exactly this value. (single value)

$is_not
string

Results omit this value. (single value)

$has_value
string

Value is NOT null. The value for this parameter is an empty string.

$is_unknown
string

Value is null. The value for this parameter is an empty string.

$starts_with
string

Value starts with the specified string.

$ends_with
string

Value ends with the specified string.

| +| exported_object
`string` |

The type of object to be exported.

Available values: `voucher_transactions` | +| parameters
`object` |

List of available fields and filters that can be exported with an order along with the sorting order of the returned data.

AttributesDescription
order

How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order.

See: Export Voucher Transactions Order
fields
array

Array of strings containing the data in the export. These fields define the headers in the CSV file.

Array of Export Voucher Transactions Fields
filters

Filter conditions.

See: Export Voucher Transactions Filters
| -## Logical Operator Between Filters -

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.

+## Export Voucher Order +Available values: `code`, `-code`, `voucher_type`, `-voucher_type`, `value`, `-value`, `discount_type`, `-discount_type`, `campaign`, `-campaign`, `category`, `-category`, `start_date`, `-start_date`, `expiration_date`, `-expiration_date`, `gift_balance`, `-gift_balance`, `loyalty_balance`, `-loyalty_balance`, `redemption_quantity`, `-redemption_quantity`, `redemption_count`, `-redemption_count`, `active`, `-active`, `qr_code`, `-qr_code`, `bar_code`, `-bar_code`, `metadata`, `-metadata`, `id`, `-id`, `is_referral_code`, `-is_referral_code`, `created_at`, `-created_at`, `updated_at`, `-updated_at`, `validity_timeframe_interval`, `-validity_timeframe_interval`, `validity_timeframe_duration`, `-validity_timeframe_duration`, `validity_day_of_week`, `-validity_day_of_week`, `discount_amount_limit`, `-discount_amount_limit`, `campaign_id`, `-campaign_id`, `additional_info`, `-additional_info`, `customer_id`, `-customer_id`, `discount_unit_type`, `-discount_unit_type`, `discount_unit_effect`, `-discount_unit_effect`, `customer_source_id`, `-customer_source_id` + +## Export Voucher Fields +Available values: `code`, `voucher_type`, `value`, `discount_type`, `campaign`, `category`, `start_date`, `expiration_date`, `gift_balance`, `loyalty_balance`, `redemption_quantity`, `redemption_count`, `active`, `qr_code`, `bar_code`, `metadata`, `id`, `is_referral_code`, `created_at`, `updated_at`, `validity_timeframe_interval`, `validity_timeframe_duration`, `validity_day_of_week`, `discount_amount_limit`, `campaign_id`, `additional_info`, `customer_id`, `discount_unit_type`, `discount_unit_effect`, `customer_source_id` + +## Export Voucher Filters +| Attributes | Description | +|:-----|:--------| +| junction |

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.

See: [Junction](#junction) | +| code | See: [Field Conditions](#field-conditions) | +| voucher_type | See: [Field Conditions](#field-conditions) | +| value | See: [Field Conditions](#field-conditions) | +| discount_type | See: [Field Conditions](#field-conditions) | +| campaign | See: [Field Conditions](#field-conditions) | +| category | See: [Field Conditions](#field-conditions) | +| start_date | See: [Field Conditions](#field-conditions) | +| expiration_date | See: [Field Conditions](#field-conditions) | +| gift_balance | See: [Field Conditions](#field-conditions) | +| loyalty_balance | See: [Field Conditions](#field-conditions) | +| redemption_quantity | See: [Field Conditions](#field-conditions) | +| redemption_count | See: [Field Conditions](#field-conditions) | +| active | See: [Field Conditions](#field-conditions) | +| qr_code | See: [Field Conditions](#field-conditions) | +| bar_code | See: [Field Conditions](#field-conditions) | +| metadata | See: [Field Conditions](#field-conditions) | +| id | See: [Field Conditions](#field-conditions) | +| is_referral_code | See: [Field Conditions](#field-conditions) | +| created_at | See: [Field Conditions](#field-conditions) | +| updated_at | See: [Field Conditions](#field-conditions) | +| validity_timeframe_interval | See: [Field Conditions](#field-conditions) | +| validity_timeframe_duration | See: [Field Conditions](#field-conditions) | +| validity_day_of_week | See: [Field Conditions](#field-conditions) | +| discount_amount_limit | See: [Field Conditions](#field-conditions) | +| campaign_id | See: [Field Conditions](#field-conditions) | +| additional_info | See: [Field Conditions](#field-conditions) | +| customer_id | See: [Field Conditions](#field-conditions) | +| discount_unit_type | See: [Field Conditions](#field-conditions) | +| discount_unit_effect | See: [Field Conditions](#field-conditions) | +| customer_source_id | See: [Field Conditions](#field-conditions) | -Available values: `AND`, `OR` - -## Filter by conditions -| Attributes | Description | -|:-----|:--------| -| conditions
`object` |

Data filters used to narrow the data records to be returned in the result.

AttributesDescription
$in
array

Array of resource values that should be included in the results. (multiple values)

$not_in
array

Array of resource values that should be included in the results. (multiple values)

$is
integer

Value is exactly this value. (single value)

$is_not
integer

Results omit this value. (single value)

$has_value
string

Value is NOT null. The value for this parameter is an empty string.

$is_unknown
string

Value is null. The value for this parameter is an empty string.

$more_than
integer

Value is more than the specified number.

$more_than_equal
integer

Value is more than or equal to the specified number.

$less_than
integer

Value is less than the specified number.

$less_than_equal
integer

Value is less than or equal to the specified number.

| - -## Filter by conditions -| Attributes | Description | -|:-----|:--------| -| conditions
`object` |

Data filters used to narrow the data records to be returned in the result.

AttributesDescription
$is
string

Value is exactly this value. (single value)

$is_not
string

Results omit this value. (single value)

$has_value
string

Value is NOT null. The value for this parameter is an empty string.

$is_unknown
string

Value is null. The value for this parameter is an empty string.

| +## Export Redemption Order +Available values: `id`, `-id`, `object`, `-object`, `date`, `-date`, `voucher_code`, `-voucher_code`, `campaign`, `-campaign`, `promotion_tier_id`, `-promotion_tier_id`, `customer_id`, `-customer_id`, `customer_source_id`, `-customer_source_id`, `customer_name`, `-customer_name`, `tracking_id`, `-tracking_id`, `order_amount`, `-order_amount`, `gift_amount`, `-gift_amount`, `loyalty_points`, `-loyalty_points`, `result`, `-result`, `failure_code`, `-failure_code`, `failure_message`, `-failure_message`, `metadata`, `-metadata` + +## Export Redemption Fields +Available values: `id`, `object`, `date`, `voucher_code`, `campaign`, `promotion_tier_id`, `customer_id`, `customer_source_id`, `customer_name`, `tracking_id`, `order_amount`, `gift_amount`, `loyalty_points`, `result`, `failure_code`, `failure_message`, `metadata` + +## Export Redemption Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| id | See: [Field Conditions](#field-conditions) | +| object | See: [Field Conditions](#field-conditions) | +| date | See: [Field Conditions](#field-conditions) | +| voucher_code | See: [Field Conditions](#field-conditions) | +| campaign | See: [Field Conditions](#field-conditions) | +| promotion_tier_id | See: [Field Conditions](#field-conditions) | +| customer_id | See: [Field Conditions](#field-conditions) | +| customer_source_id | See: [Field Conditions](#field-conditions) | +| customer_name | See: [Field Conditions](#field-conditions) | +| tracking_id | See: [Field Conditions](#field-conditions) | +| order_amount | See: [Field Conditions](#field-conditions) | +| gift_amount | See: [Field Conditions](#field-conditions) | +| loyalty_points | See: [Field Conditions](#field-conditions) | +| result | See: [Field Conditions](#field-conditions) | +| failure_code | See: [Field Conditions](#field-conditions) | +| failure_message | See: [Field Conditions](#field-conditions) | +| metadata | See: [Field Conditions](#field-conditions) | + +## Export Customer Order +Available values: `name`, `-name`, `id`, `-id`, `description`, `-description`, `email`, `-email`, `source_id`, `-source_id`, `created_at`, `-created_at`, `address_city`, `-address_city`, `address_state`, `-address_state`, `address_line_1`, `-address_line_1`, `address_line_2`, `-address_line_2`, `address_country`, `-address_country`, `address_postal_code`, `-address_postal_code`, `redemptions_total_redeemed`, `-redemptions_total_redeemed`, `redemptions_total_failed`, `-redemptions_total_failed`, `redemptions_total_succeeded`, `-redemptions_total_succeeded`, `redemptions_total_rolled_back`, `-redemptions_total_rolled_back`, `redemptions_total_rollback_failed`, `-redemptions_total_rollback_failed`, `redemptions_total_rollback_succeeded`, `-redemptions_total_rollback_succeeded`, `orders_total_amount`, `-orders_total_amount`, `orders_total_count`, `-orders_total_count`, `orders_average_amount`, `-orders_average_amount`, `orders_last_order_amount`, `-orders_last_order_amount`, `orders_last_order_date`, `-orders_last_order_date`, `loyalty_points`, `-loyalty_points`, `loyalty_referred_customers`, `-loyalty_referred_customers`, `updated_at`, `-updated_at`, `phone`, `-phone`, `birthday`, `-birthday`, `metadata`, `-metadata`, `birthdate`, `-birthdate` + +## Export Customer Fields +Available values: `name`, `id`, `description`, `email`, `source_id`, `created_at`, `address_city`, `address_state`, `address_line_1`, `address_line_2`, `address_country`, `address_postal_code`, `redemptions_total_redeemed`, `redemptions_total_failed`, `redemptions_total_succeeded`, `redemptions_total_rolled_back`, `redemptions_total_rollback_failed`, `redemptions_total_rollback_succeeded`, `orders_total_amount`, `orders_total_count`, `orders_average_amount`, `orders_last_order_amount`, `orders_last_order_date`, `loyalty_points`, `loyalty_referred_customers`, `updated_at`, `phone`, `birthday`, `metadata`, `birthdate` + +## Export Customer Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| name | See: [Field Conditions](#field-conditions) | +| id | See: [Field Conditions](#field-conditions) | +| description | See: [Field Conditions](#field-conditions) | +| email | See: [Field Conditions](#field-conditions) | +| source_id | See: [Field Conditions](#field-conditions) | +| created_at | See: [Field Conditions](#field-conditions) | +| address_city | See: [Field Conditions](#field-conditions) | +| address_state | See: [Field Conditions](#field-conditions) | +| address_line_1 | See: [Field Conditions](#field-conditions) | +| address_line_2 | See: [Field Conditions](#field-conditions) | +| address_country | See: [Field Conditions](#field-conditions) | +| address_postal_code | See: [Field Conditions](#field-conditions) | +| redemptions_total_redeemed | See: [Field Conditions](#field-conditions) | +| redemptions_total_failed | See: [Field Conditions](#field-conditions) | +| redemptions_total_succeeded | See: [Field Conditions](#field-conditions) | +| redemptions_total_rolled_back | See: [Field Conditions](#field-conditions) | +| redemptions_total_rollback_failed | See: [Field Conditions](#field-conditions) | +| redemptions_total_rollback_succeeded | See: [Field Conditions](#field-conditions) | +| orders_total_amount | See: [Field Conditions](#field-conditions) | +| orders_total_count | See: [Field Conditions](#field-conditions) | +| orders_average_amount | See: [Field Conditions](#field-conditions) | +| orders_last_order_amount | See: [Field Conditions](#field-conditions) | +| orders_last_order_date | See: [Field Conditions](#field-conditions) | +| loyalty_points | See: [Field Conditions](#field-conditions) | +| loyalty_referred_customers | See: [Field Conditions](#field-conditions) | +| updated_at | See: [Field Conditions](#field-conditions) | +| phone | See: [Field Conditions](#field-conditions) | +| birthday | See: [Field Conditions](#field-conditions) | +| metadata | See: [Field Conditions](#field-conditions) | +| birthdate | See: [Field Conditions](#field-conditions) | + +## Export Publication Order +Available values: `voucher_code`, `-voucher_code`, `customer_id`, `-customer_id`, `customer_source_id`, `-customer_source_id`, `date`, `-date`, `channel`, `-channel`, `campaign`, `-campaign`, `is_winner`, `-is_winner`, `metadata`, `-metadata` + +## Export Publication Fields +Available values: `voucher_code`, `customer_id`, `customer_source_id`, `date`, `channel`, `campaign`, `is_winner`, `metadata` + +## Export Publication Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| voucher_code | See: [Field Conditions](#field-conditions) | +| customer_id | See: [Field Conditions](#field-conditions) | +| customer_source_id | See: [Field Conditions](#field-conditions) | +| date | See: [Field Conditions](#field-conditions) | +| channel | See: [Field Conditions](#field-conditions) | +| campaign | See: [Field Conditions](#field-conditions) | +| is_winner | See: [Field Conditions](#field-conditions) | +| metadata | See: [Field Conditions](#field-conditions) | + +## Export Order Order +Available values: `id`, `-id`, `source_id`, `-source_id`, `created_at`, `-created_at`, `updated_at`, `-updated_at`, `status`, `-status`, `amount`, `-amount`, `discount_amount`, `-discount_amount`, `items_discount_amount`, `-items_discount_amount`, `total_discount_amount`, `-total_discount_amount`, `total_amount`, `-total_amount`, `customer_id`, `-customer_id`, `referrer_id`, `-referrer_id`, `metadata`, `-metadata` + +## Export Order Fields +Available values: `id`, `source_id`, `created_at`, `updated_at`, `status`, `amount`, `discount_amount`, `items_discount_amount`, `total_discount_amount`, `total_amount`, `customer_id`, `referrer_id`, `metadata` + +## Export Order Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| id | See: [Field Conditions](#field-conditions) | +| source_id | See: [Field Conditions](#field-conditions) | +| created_at | See: [Field Conditions](#field-conditions) | +| updated_at | See: [Field Conditions](#field-conditions) | +| status | See: [Field Conditions](#field-conditions) | +| amount | See: [Field Conditions](#field-conditions) | +| discount_amount | See: [Field Conditions](#field-conditions) | +| items_discount_amount | See: [Field Conditions](#field-conditions) | +| total_discount_amount | See: [Field Conditions](#field-conditions) | +| total_amount | See: [Field Conditions](#field-conditions) | +| customer_id | See: [Field Conditions](#field-conditions) | +| referrer_id | See: [Field Conditions](#field-conditions) | +| metadata | See: [Field Conditions](#field-conditions) | + +## Export Points Expiration Order +Available values: `id`, `-id`, `campaign_id`, `-campaign_id`, `voucher_id`, `-voucher_id`, `points`, `-points`, `status`, `-status`, `expires_at`, `-expires_at` + +## Export Points Expiration Fields +Available values: `id`, `campaign_id`, `voucher_id`, `points`, `status`, `expires_at` + +## Export Points Expiration Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| id | See: [Field Conditions](#field-conditions) | +| campaign_id | See: [Field Conditions](#field-conditions) | +| voucher_id | See: [Field Conditions](#field-conditions) | +| points | See: [Field Conditions](#field-conditions) | +| status | See: [Field Conditions](#field-conditions) | +| expires_at | See: [Field Conditions](#field-conditions) | + +## Export Voucher Transactions Order +Available values: `id`, `-id`, `campaign_id`, `-campaign_id`, `voucher_id`, `-voucher_id`, `type`, `-type`, `source_id`, `-source_id`, `reason`, `-reason`, `source`, `-source`, `balance`, `-balance`, `amount`, `-amount`, `related_transaction_id`, `-related_transaction_id`, `created_at`, `-created_at`, `details`, `-details` + +## Export Voucher Transactions Fields +Available values: `id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details` + +## Export Voucher Transactions Filters +| Attributes | Description | +|:-----|:--------| +| junction | See: [Junction](#junction) | +| id | See: [Field Conditions](#field-conditions) | +| campaign_id | See: [Field Conditions](#field-conditions) | +| voucher_id | See: [Field Conditions](#field-conditions) | +| type | See: [Field Conditions](#field-conditions) | +| source_id | See: [Field Conditions](#field-conditions) | +| reason | See: [Field Conditions](#field-conditions) | +| source | See: [Field Conditions](#field-conditions) | +| balance | See: [Field Conditions](#field-conditions) | +| amount | See: [Field Conditions](#field-conditions) | +| related_transaction_id | See: [Field Conditions](#field-conditions) | +| created_at | See: [Field Conditions](#field-conditions) | +| details | See: [Field Conditions](#field-conditions) | + +## Junction +Available values: `and`, `AND`, `or`, `OR` + +## Field Conditions +| Attributes | Description | +|:-----|:--------| +| conditions |

Data filters used to narrow the data records to be returned in the result.

See: [Filters Condition](#filters-condition) | + +## Filters Condition +| Attributes | Description | +|:-----|:--------| +| $in | See: [Any](#any) | +| $not_in | See: [Any](#any) | +| $is | See: [Any](#any) | +| $is_days_ago | See: [Any](#any) | +| $is_days_in_future | See: [Any](#any) | +| $is_not | See: [Any](#any) | +| $has_value | See: [Any](#any) | +| $is_unknown | See: [Any](#any) | +| $contains | See: [Any](#any) | +| $not_contain | See: [Any](#any) | +| $starts_with | See: [Any](#any) | +| $ends_with | See: [Any](#any) | +| $more_than | See: [Any](#any) | +| $less_than | See: [Any](#any) | +| $more_than_ago | See: [Any](#any) | +| $less_than_ago | See: [Any](#any) | +| $more_than_future | See: [Any](#any) | +| $less_than_future | See: [Any](#any) | +| $more_than_equal | See: [Any](#any) | +| $less_than_equal | See: [Any](#any) | +| $after | See: [Any](#any) | +| $before | See: [Any](#any) | +| $count | See: [Any](#any) | +| $count_less | See: [Any](#any) | +| $count_more | See: [Any](#any) | + +## Any +Any of: + + 1. Array any of: string, number, object + 2. string + 3. number + 4. object [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 bc8014711..30b3ff6b7 100644 --- a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md +++ b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md @@ -11,10 +11,88 @@ order: 3 ## Stackable Redemptions Response Body | Attributes | Description | |:-----|:--------| -| redemptions
`array` | | +| redemptions
`array` | Array any of: [Discount Voucher](#discount-voucher), [Loyalty Card Voucher](#loyalty-card-voucher), [Gift Card](#gift-card), [Promotion Tier](#promotion-tier) | | parent_redemption
`object` |

This is an object representing a stacked redemption.

Stacked Redemption

AttributesDescription
id
string

Unique redemption ID.

Example:

r_0bc92f81a6801f9bca

object
string

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

date
string

Timestamp in ISO 8601 format indicating when the redemption occured.

Example:

2022-10-03T12:24:58.008Z

customer_id
string

Unique customer ID of the redeeming customer.

Example:

cust_i8t5Tt6eiKG5K79KQlJ0Vs64

tracking_id
string

Hashed customer source ID.

Example:

track_fxEMFiLowFHg==

metadata
object

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.

result
string

Redemption result.

Available values: SUCCESS, FAILURE
order

Defines the details of the order that is related to the redemption.

See: Order
customer
object

Defines the customer making the stacked redemption.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

related_object_type
string

Defines the related object.

Available values: redemption
related_object_id
string

Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption.

voucher
null
| | order |

Contains the order details associated with the redemption.

See: [Order](#order) | +## Discount Voucher +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique redemption ID.

**Example:**

r_0bc92f81a6801f9bca

| +| object
`string` |

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

| +| date
`string` |

Timestamp in ISO 8601 format indicating when the redemption occured.

**Example:**

2022-10-03T12:24:58.008Z

| +| customer_id
`string` |

Unique customer ID of the redeeming customer.

**Example:**

cust_i8t5Tt6eiKG5K79KQlJ0Vs64

| +| tracking_id
`string` |

Hashed customer source ID.

**Example:**

track_fxEMFiLowFHg==

| +| metadata
`object` |

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.

| +| redemption
`string` |

Unique redemption ID of the parent redemption.

**Example:**

r_0c656311b5878a2031

| +| result
`string` |

Redemption result.

Available values: `SUCCESS`, `FAILURE` | +| order |

Defines the details of the order that is related to the redemption.

See: [Order object](#order-object) | +| channel
`object` |

Defines the details of the channel through which the redemption was issued.

AttributesDescription
channel_id
string

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:

user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH

channel_type
string

The source of the channel for the redemption. A USER corresponds to the Voucherify Dashboard and an API corresponds to the API.

Available values: USER, API
| +| customer
`object` |

Defines the customer that is related to the redemption.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| related_object_type
`string` |

Defines the related object.

Related ObjectDefinition
voucherEither a discount voucher, gift card, or loyalty card.
Available values: `voucher` | +| related_object_id
`string` |

Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.

| +| voucher |

Defines the details of the voucher being redeemed.

See: [Voucher Object](#voucher-object) | + +## Loyalty Card Voucher +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique redemption ID.

**Example:**

r_0bc92f81a6801f9bca

| +| object
`string` |

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

| +| date
`string` |

Timestamp in ISO 8601 format indicating when the redemption occured.

**Example:**

2022-10-03T12:24:58.008Z

| +| customer_id
`string` |

Unique customer ID of the redeeming customer.

**Example:**

cust_i8t5Tt6eiKG5K79KQlJ0Vs64

| +| tracking_id
`string` |

Hashed customer source ID.

**Example:**

track_fxEMFiLowFHg==

| +| metadata
`object` |

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.

| +| amount
`integer` |

Number of points being redeemed for a reward.

| +| redemption
`string` |

Unique redemption ID of the parent redemption.

**Example:**

r_0c656311b5878a2031

| +| result
`string` |

Redemption result.

Available values: `SUCCESS`, `FAILURE` | +| order |

Defines the details of the order that is related to the redemption.

See: [Order object](#order-object) | +| channel
`object` |

Defines the details of the channel through which the redemption was issued.

AttributesDescription
channel_id
string

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:

user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH

channel_type
string

The source of the channel for the redemption. A USER corresponds to the Voucherify Dashboard and an API corresponds to the API.

Available values: USER, API
| +| customer
`object` |

Defines the customer redeeming the reward.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| related_object_type
`string` |

Defines the related object. i.e. voucher.

Available values: `voucher` | +| related_object_id
`string` |

Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.

| +| voucher |

Defines the details of the voucher being redeemed.

See: [Voucher Object](#voucher-object) | +| reward |

Defines the reward being redeemed.

Any of: [Pay with Points Reward](#pay-with-points-reward), [Product Material Reward](#product-material-reward), [SKU Material Reward](#sku-material-reward), [Digital Reward](#digital-reward) | +| loyalty_card
`object` |

Stores the number of points being subtracted from the loyalty card for the reward redemption.

AttributesDescription
points
integer

Number of points being subtracted from the loyalty card for the reward redemption.

| + +## Gift Card +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique redemption ID.

**Example:**

r_0bc92f81a6801f9bca

| +| object
`string` |

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

| +| date
`string` |

Timestamp in ISO 8601 format indicating when the redemption occured.

**Example:**

2022-10-03T12:24:58.008Z

| +| customer_id
`string` |

Unique customer ID of the redeeming customer.

**Example:**

cust_i8t5Tt6eiKG5K79KQlJ0Vs64

| +| tracking_id
`string` |

Hashed customer source ID.

**Example:**

track_fxEMFiLowFHg==

| +| metadata
`object` |

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.

| +| amount
`integer` |

The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00).

| +| redemption
`string` |

Unique redemption ID of the parent redemption.

**Example:**

r_0c656311b5878a2031

| +| result
`string` |

Redemption result.

Available values: `SUCCESS`, `FAILURE` | +| order |

Defines the details of the order that is related to the redemption.

See: [Order object](#order-object) | +| channel
`object` |

Defines the details of the channel through which the redemption was issued.

AttributesDescription
channel_id
string

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:

user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH

channel_type
string

The source of the channel for the redemption. A USER corresponds to the Voucherify Dashboard and an API corresponds to the API.

Available values: USER, API
| +| customer
`object` |

Defines the customer redeeming the gift card.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| related_object_type
`string` |

Defines the related object.

Related ObjectDefinition
voucherEither a discount voucher, gift card, or loyalty card.
Available values: `voucher` | +| related_object_id
`string` |

Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher.

| +| voucher |

Defines the details of the voucher being redeemed.

See: [Voucher Object](#voucher-object) | +| gift
`object` |

Contains the amount being subtracted from the gift card for the redemption.

AttributesDescription
amount
integer

The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00).

| + +## Promotion Tier +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique redemption ID.

**Example:**

r_0bc92f81a6801f9bca

| +| object
`string` |

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

| +| date
`string` |

Timestamp in ISO 8601 format indicating when the redemption occured.

**Example:**

2022-10-03T12:24:58.008Z

| +| customer_id
`string` |

Unique customer ID of the redeeming customer.

**Example:**

cust_i8t5Tt6eiKG5K79KQlJ0Vs64

| +| tracking_id
`string` |

Hashed customer source ID.

**Example:**

track_fxEMFiLowFHg==

| +| metadata
`object` |

The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption.

| +| redemption
`string` |

Unique redemption ID of the parent redemption.

**Example:**

r_0c656311b5878a2031

| +| result
`string` |

Redemption result.

Available values: `SUCCESS`, `FAILURE` | +| order |

Defines the details of the order that is related to the redemption.

See: [Order object](#order-object) | +| channel
`object` |

Defines the details of the channel through which the redemption was issued.

AttributesDescription
channel_id
string

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:

user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH

channel_type
string

The source of the channel for the redemption. A USER corresponds to the Voucherify Dashboard and an API corresponds to the API.

Available values: USER, API
| +| customer
`object` |

Defines the customer that is related to the redemption.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| related_object_type
`string` |

Defines the related object.

Available values: `promotion_tier` | +| related_object_id
`string` |

Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier.

| +| voucher
`null` | | +| promotion_tier |

Contains details of the promotion tier and the parent campaign.

See: [Promotion Tier Object](#promotion-tier-object) | + ## Order | Attributes | Description | |:-----|:--------| @@ -40,11 +118,309 @@ order: 3 | object
`string` |

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

| | redemptions |

Lists details related to the redemption

See: [Stacked Redemption](#stacked-redemption) | +## Order object +

This is an object representing an order with calculated discounts applied using the voucher code.

+ +One of: + +[Order object - Effect: Apply to order](#order-object---effect:-apply-to-order), [Order object - Effect: Apply to items](#order-object---effect:-apply-to-items) + +## Voucher Object +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Assigned by the Voucherify API, identifies the voucher.

**Example:**

v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV

| +| code
`string` |

A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.

**Example:**

WVPblOYX

| +| campaign
`string` |

A unique campaign name, identifies the voucher's parent campaign.

**Example:**

Gift Card Campaign

| +| campaign_id
`string` |

Assigned by the Voucherify API, identifies the voucher's parent campaign.

**Example:**

camp_FNYR4jhqZBM9xTptxDGgeNBV

| +| category
`string` |

Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.

| +| category_id
`string` |

Unique category ID assigned by Voucherify.

**Example:**

cat_0bb343dee3cdb5ec0c

| +| categories
`array` |

Contains details about the category.

Array of [Category Object](#category-object) | +| type
`string` |

Defines the type of voucher.

Available values: `GIFT_VOUCHER`, `DISCOUNT_VOUCHER`, `LOYALTY_CARD` | +| discount | One of: [Amount](#amount), [Percentage](#percentage), [Fixed](#fixed), [Unit, single item](#unit-single-item), [Unit, multiple items](#unit-multiple-items), [Shipping](#shipping) | +| gift
`object` |

Object representing gift parameters. Child attributes are present only if type is GIFT_VOUCHER. Defaults to null.

AttributesDescription
amount
integer

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.

Example:

10000

balance
integer

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

Example:

500

effect
string

Defines how the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
| +| loyalty_card
`object` |

Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD. Defaults to null.

AttributesDescription
points
integer

Total points incurred over lifespan of loyalty card.

Example:

7000

balance
integer

Points available for reward redemption.

Example:

6970

next_expiration_date
string

The next closest date when the next set of points are due to expire.

Example:

2023-05-30

next_expiration_points
integer

The amount of points that are set to expire next.

| +| start_date
`string` |

Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.

**Example:**

2021-12-01T00:00:00.000Z

| +| expiration_date
`string` |

Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.

**Example:**

2021-12-31T00:00:00.000Z

| +| validity_timeframe
`object` |

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.

AttributesDescription
duration
string

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.

Example:

PT1H

interval
string

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.

Example:

P2D

| +| validity_day_of_week
`array` |

Integer array corresponding to the particular days of the week in which the voucher is valid.

Available values: `0`, `1`, `2`, `3`, `4`, `5`, `6` | +| active
`boolean` |

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.

| +| additional_info
`string` |

An optional field to keep any extra textual information about the code such as a code description and details.

| +| metadata
`object` |

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
`object` |

Stores links to images of QR and barcode that correspond to an encrypted voucher code.

AttributesDescription
qr
object

Stores Quick Response (QR) representation of encrypted code.

AttributesDescription
id
string

Encrypted voucher code ID.

Example:

U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==

url
string

URL to QR code

Optional: Attach query parameters to base URL to customize the image of the encrypted voucher code.

  • size: integer value from 1 to 100
  • format: string, either png (default) or svg
Example:

https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D

barcode
object

Stores barcode representation of encrypted code.

AttributesDescription
id
string

Encrypted voucher code ID.

Example:

U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==

url
string

URL to barcode

Optional: Attach query parameters to base URL to customize the image of the encrypted voucher code.

  • size: integer value from 1 to 100
  • format: string, either png (default) or svg
Example:

https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D

| +| is_referral_code
`boolean` |

Flag indicating whether this voucher is a referral code.

| +| created_at
`string` |

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

**Example:**

2021-12-22T10:13:06.487Z

| +| updated_at
`string` |

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

**Example:**

2021-12-22T10:14:45.316Z

| +| holder_id
`string` |

Unique customer ID of voucher owner.

**Example:**

cust_eWgXlBBiY6THFRJwX45Iakv4

| +| validation_rules_assignments
`object` |

Stores information about validation rules assigned to the voucher.

AttributesDescription
object
string

The type of object represented is by default list.

data_ref
string

Identifies the name of the attribute that contains the array of validation rule assignments.

data
array

Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.

Array of:
AttributesDescription
id
string

Assigned by the Voucherify API, identifies the validation rule assignment.

Example:

asgm_N7t39epaQR2SkQcW

rule_id
string

Assigned by the Voucherify API, identifies the validation rule.

Example:

val_ssbxf1L9aKri

related_object_id
string

ID of the object from which the rule originates, can be the ID of the voucher itself or its parent campaign.

Example:

camp_AaP9MC1Y0GpBII84UTIuasvb

related_object_type
string

Which object does the rule originate from: the voucher itself or inherited from its parent campaign.

Example:

campaign

created_at
string

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

Example:

2022-02-14T15:12:06.817Z

object
string

The type of resource represented by the object. Default is validation_rules_assignment.

total
integer

Total number of validation rules assigned to the voucher.

| +| redemption
`object` |

Stores a summary of redemptions that have been applied to the voucher.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

redeemed_quantity
integer

How many times a voucher has already been redeemed.

Example:

1

redeemed_amount
integer

Total amount redeemed. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 balance is written as 10000.

Example:

100000

redeemed_points
integer

Total loyalty points redeemed.

Example:

100000

object
string

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
string

The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions

Example:

/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10

| +| publish
`object` |

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.

RequiredOptional
type:LOYALTY_CARDtype:DISCOUNT_VOUCHER
is_referral_code:truetype:GIFT_VOUCHER
AttributesDescription
object
string

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
integer

Publication events counter.

Example:

0

url
string

The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications

Example:

/v1/vouchers/WVPblOYX/publications?page=1&limit=10

| +| object
`string` |

The type of object represented by JSON. Default is voucher.

| + +## Pay with Points Reward +| Attributes | Description | +|:-----|:--------| +| customer
`object` |

Defines the customer redeeming the reward.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| assignment_id
`string` |

Unique reward assginment ID assigned by Voucherify.

**Example:**

rewa_YAIuU7AY6LNJVlUbRxSbNgiD

| +| id
`string` |

Unique reward ID assigned by Voucherify.

**Example:**

rew_INt3fGH3n7xIr3ZQcq4kkUZ1

| +| object
`string` |

Type of object represented is reward.

| +| name
`string` |

Reward name.

| +| created_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was created.

**Example:**

2022-10-03T12:24:58.008Z

| +| updated_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was updated.

**Example:**

2022-10-03T12:24:58.008Z

| +| parameters
`object` |

These are parameters representing a Pay with Points (COIN) reward.

AttributesDescription
coin
object

Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.

AttributesDescription
exchange_ratio
integer

The cash equivalent of the points defined in the points_ratio property.

points_ratio
integer

The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property.

| +| type
`string` |

Reward type

Available values: `COIN` | + +## Product Material Reward +| Attributes | Description | +|:-----|:--------| +| customer
`object` |

Defines the customer redeeming the reward.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| assignment_id
`string` |

Unique reward assginment ID assigned by Voucherify.

**Example:**

rewa_YAIuU7AY6LNJVlUbRxSbNgiD

| +| product |

Details of the product redeemed as a reward.

See: [Product Object](#product-object) | +| id
`string` |

Unique reward ID assigned by Voucherify.

**Example:**

rew_INt3fGH3n7xIr3ZQcq4kkUZ1

| +| object
`string` |

Type of object represented is reward.

| +| name
`string` |

Reward name.

| +| created_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was created.

**Example:**

2022-10-03T12:24:58.008Z

| +| updated_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was updated.

**Example:**

2022-10-03T12:24:58.008Z

| +| parameters
`object` |

These are parameters representing a material reward.

AttributesDescription
product
object

Defines the product redeemed as a reward.

AttributesDescription
id
string

Unique product ID assignedy by Voucherify of the product.

Example:

prod_0b2c2ddf35150b83bb

sku_id
null
| +| type
`string` |

Reward type

Available values: `MATERIAL` | + +## SKU Material Reward +| Attributes | Description | +|:-----|:--------| +| customer
`object` |

Defines the customer redeeming the reward.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| assignment_id
`string` |

Unique reward assginment ID assigned by Voucherify.

**Example:**

rewa_YAIuU7AY6LNJVlUbRxSbNgiD

| +| product |

Details of the SKU's parent product redeemed as a reward.

See: [Product Object](#product-object) | +| sku |

Details of the SKU redeemed as a reward.

See: [SKU Object](#sku-object) | +| id
`string` |

Unique reward ID assigned by Voucherify.

**Example:**

rew_INt3fGH3n7xIr3ZQcq4kkUZ1

| +| object
`string` |

Type of object represented is reward.

| +| name
`string` |

Reward name.

| +| created_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was created.

**Example:**

2022-10-03T12:24:58.008Z

| +| updated_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was updated.

**Example:**

2022-10-03T12:24:58.008Z

| +| parameters
`object` |

These are parameters representing a material reward.

AttributesDescription
product
object

Defines the SKU redeemed as a reward.

AttributesDescription
id
string

Unique product ID assignedy by Voucherify of the SKU's parent.

sku_id
string

Unique SKU ID assigned by Voucherify of the SKU redeemed as a reward.

| +| type
`string` |

Reward type

Available values: `MATERIAL` | + +## Digital Reward +| Attributes | Description | +|:-----|:--------| +| customer
`object` |

Defines the customer redeeming the reward.

AttributesDescription
id
string

The unique ID of a customer that is assigned by Voucherify.

Example:

cust_eWgXlBBiY6THFRJwX45Iakv4

name
string

Customer's first and last name.

email
string

Customer's email address.

source_id
string

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
object

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
string

Type of object represented is customer.

| +| assignment_id
`string` |

Unique reward assginment ID assigned by Voucherify.

**Example:**

rewa_YAIuU7AY6LNJVlUbRxSbNgiD

| +| voucher |

Voucher object.

See: [Voucher Object](#voucher-object) | +| id
`string` |

Unique reward ID assigned by Voucherify.

**Example:**

rew_INt3fGH3n7xIr3ZQcq4kkUZ1

| +| object
`string` |

Type of object represented is reward.

| +| name
`string` |

Reward name.

| +| created_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was created.

**Example:**

2022-10-03T12:24:58.008Z

| +| updated_at
`string` |

Timestamp in ISO 8601 format indicating when the reward was updated.

**Example:**

2022-10-03T12:24:58.008Z

| +| parameters
`object` |

These are parameters representing a digital reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.

AttributesDescription
campaign

Defines the source of the digital reward.

Any of: Discount Voucher, Gift Card, Loyalty Card
| +| type
`string` |

Reward type

Available values: `CAMPAIGN` | + +## Promotion Tier Object +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique promotion tier ID.

**Example:**

promo_63fYCt81Aw0h7lzyRkrGZh9p

| +| created_at
`string` |

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

**Example:**

2021-12-15T11:34:01.333Z

| +| updated_at
`string` |

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

**Example:**

2022-02-09T09:20:05.603Z

| +| name
`string` |

Name of the promotion tier.

| +| banner
`string` |

Text to be displayed to your customers on your website.

| +| action
`object` |

Contains details about the discount applied by the promotion tier.

AttributesDescription
discount

The type of discount that will be applied to a customer's order.

Any of: Amount, Percentage, Fixed, Unit, single item, Unit, multiple items, Shipping
| +| metadata
`object` |

The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format.

| +| hierarchy
`integer` |

The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy.

| +| campaign
`object` |

Contains details about promotion tier's parent campaign.

AttributesDescription
id
string

Unique campaign ID.

start_date
string

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

Example:

2022-09-22T00:00:00.000Z

expiration_date
string

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

Example:

2022-09-30T00:00:00.000Z

validity_timeframe
object

Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.

AttributesDescription
interval
string

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
string

Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a duration of P1D will be valid for a duration of one day.

validity_day_of_week
array

Integer array corresponding to the particular days of the week in which the campaign is valid.

  • 0 Sunday
  • 1 Monday
  • 2 Tuesday
  • 3 Wednesday
  • 4 Thursday
  • 5 Friday
  • 6 Saturday
active
boolean

A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the start_date and expiration_date using the Disable Campaign endpoint.

  • true indicates an active campaign
  • false indicates an inactive campaign
category_id
string

Unique category ID that this campaign belongs to.

Example:

cat_0b688929a2476386a6

object
string

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

| +| campaign_id
`string` |

Promotion tier's parent campaign's unique ID.

| +| active
`boolean` |

A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the start_date and expiration_date.

| +| start_date
`string` |

Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is inactive before this date.

**Example:**

2022-09-23T00:00:00.000Z

| +| expiration_date
`string` |

Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is inactive after this date.

**Example:**

2022-09-26T00:00:00.000Z

| +| validity_timeframe
`object` |

Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.

AttributesDescription
interval
string

Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an interval of P2D will be active every other day.

duration
string

Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a duration of P1D will be valid for a duration of one day.

| +| validity_day_of_week
`array` |

Integer array corresponding to the particular days of the week in which the promotion tier is valid.

| +| summary
`object` |

Contains statistics about promotion tier redemptions and orders.

AttributesDescription
redemptions
object

Contains statistics about promotion tier redemptions.

AttributesDescription
total_redeemed
integer

Number of times the promotion tier was redeemed.

orders
object

Contains statistics about orders related to the promotion tier.

AttributesDescription
total_amount
integer

Sum of order totals.

total_discount_amount
integer

Sum of total discount applied using the promotion tier.

| +| object
`string` |

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

| +| validation_rule_assignments | See: [Validation Rule Assignments](#validation-rule-assignments) | +| category_id
`string` |

Promotion tier category ID.

**Example:**

cat_0c9da30e7116ba6bba

| +| categories |

Details about the category assigned to the promotion tier.

See: [Category Object](#category-object) | + ## Stacked Redemption | Attributes | Description | |:-----|:--------| | redemption_ID
`object` |

The property name is the unique parent redemption ID; i.e. r_0ba186c4824e4881e1. This object contains information about the redemption of multiple incentives.

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.

related_object_id
string

Unique ID of the parent redemption.

Example:

r_0ba186c4824e4881e1

stacked
array

Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.

| +## Order object - Effect: Apply to order +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique order ID, assigned by Voucherify.

**Example:**

ord_OLWs41pBk7VFn6ZTyX9U6keh

| +| source_id
`string` |

The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service.

| +| created_at
`string` |

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

**Example:**

2022-10-06T11:40:48.705Z

| +| updated_at
`string` |

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

**Example:**

2022-10-06T11:47:20.760Z

| +| status
`string` |

Order status.

Available values: `CREATED`, `PAID`, `CANCELED`, `FULFILLED` | +| amount
`integer` |

Order amount before applying any discount.

| +| discount_amount
`integer` |

Sum of all order-level discounts applied to the order.

| +| total_discount_amount
`integer` |

Sum of all order-level AND all product-specific discounts applied to the order.
total_discount_amount = discount_amount + items_discount_amount

| +| total_amount
`integer` |

Order amount after applying all the discounts.
total_amount = amount - total_discount_amount

| +| applied_discount_amount
`integer` |

This field shows the order-level discount applied.

| +| total_applied_discount_amount
`integer` |

This field sums up all order-level and all product-specific discounts applied in a particular request.

| +| items
`array` |

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.

Array of:
AttributesDescription
object
string

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

product_id
string

A unique identifier that represents the product and is assigned by Voucherify.

Example:

prod_5h0wc453_1

sku_id
string

A unique identifier that represents the SKU and is assigned by Voucherify.

Example:

sku_prod_5h0wc453_1_1

quantity
integer

Quantity of the item in the cart.

amount
integer

Represents a total pre-discount amount of order item (price * quantity).

price
integer

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
integer

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.
subtotal_amount=amount-discount_amount

product
object

This object stores more information about the related product.

AttributesDescription
id
string

A unique identifier that represents the product and is assigned by Voucherify.

Example:

prod_5h0wc453_1

source_id
string

A unique product identifier from your inventory system.

Example:

illy-arabica

name
string

Product name.

Example:

Brewing System

price
integer

Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

sku
object

This object stores more information about the related SKU.

AttributesDescription
id
string

A unique identifier that represents the SKU and is assigned by Voucherify.

Example:

sku_prod_5h0wc453_1_1

source_id
string

A unique SKU identifier from your inventory system.

Example:

illy-arabica-250g

sku
string

SKU name.

price
integer

Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

| +| metadata
`object` |

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
`object` |

Object containing information about the customer that is making the purchase.

AttributesDescription
id
string

Unique customer ID of the customer making the purchase.

Example:

cust_7iUa6ICKyU6gH40dBU25kQU1

object
string

Type of object represented by the customer object.

| +| referrer
`object` |

Object containing information about the referrer.

AttributesDescription
id
string

Unique referrer ID, who referred the customer making the purchase.

Example:

cust_7iUa6ICKyU6gH40dBU25kQU1

object
string

Type of object represented by the referrer object.

| +| customer_id
`string` |

Unique customer ID of the customer making the purchase.

**Example:**

cust_7iUa6ICKyU6gH40dBU25kQU1

| +| referrer_id
`string` |

Unique referrer ID.

**Example:**

cust_nM4jqPiaXUvQdVSA6vTRUnix

| +| object
`string` |

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

| +| redemptions |

Lists details related to the redemption.

See: [Unstacked Redemption](#unstacked-redemption) | + +## Order object - Effect: Apply to items +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique order ID, assigned by Voucherify.

**Example:**

ord_OLWs41pBk7VFn6ZTyX9U6keh

| +| source_id
`string` |

The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service.

| +| created_at
`string` |

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

**Example:**

2022-10-06T11:40:48.705Z

| +| updated_at
`string` |

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

**Example:**

2022-10-06T11:47:20.760Z

| +| status
`string` |

Order status.

Available values: `CREATED`, `PAID`, `CANCELED`, `FULFILLED` | +| amount
`integer` |

Order amount before applying any discount.

| +| items_discount_amount
`integer` |

Sum of all product-specific discounts applied to the order.
sum(items, i => i.discount_amount)

| +| total_discount_amount
`integer` |

Sum of all order-level AND all product-specific discounts applied to the order.

| +| total_amount
`integer` |

Order amount after applying all the discounts.
total_amount = amount - total_discount_amount

| +| items_applied_discount_amount
`integer` |

Sum of all product-specific discounts applied.

| +| total_applied_discount_amount
`integer` |

Sum of all order-level AND all product-specific discounts applied to the order.

| +| items
`array` |

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.

Array of:
AttributesDescription
object
string

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

product_id
string

A unique identifier that represents the product and is assigned by Voucherify.

Example:

prod_5h0wc453_1

sku_id
string

A unique identifier that represents the SKU and is assigned by Voucherify.

Example:

sku_prod_5h0wc453_1_1

quantity
integer

Quantity of the item in the cart.

amount
integer

Represents a total pre-discount amount of order item (price * quantity).

discount_amount
integer

The item-level discount applied to the item.

applied_discount_amount
integer

The item-level discount applied to the item.

price
integer

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
integer

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.
subtotal_amount=amount-discount_amount

product
object

This object stores more information about the related product.

AttributesDescription
id
string

A unique identifier that represents the product and is assigned by Voucherify.

Example:

prod_5h0wc453_1

source_id
string

A unique product identifier from your inventory system.

Example:

illy-arabica

name
string

Product name.

Example:

Brewing System

price
integer

Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

sku
object

This object stores more information about the related SKU.

AttributesDescription
id
string

A unique identifier that represents the SKU and is assigned by Voucherify.

Example:

sku_prod_5h0wc453_1_1

source_id
string

A unique SKU identifier from your inventory system.

Example:

illy-arabica-250g

sku
string

SKU name.

price
integer

Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

| +| metadata
`object` |

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
`object` |

Object containing information about the customer that is making the purchase.

AttributesDescription
id
string

Unique customer ID of the customer making the purchase.

Example:

cust_7iUa6ICKyU6gH40dBU25kQU1

object
string

Type of object represented by the customer object.

| +| referrer
`object` |

Object containing information about the referrer.

AttributesDescription
id
string

Unique referrer ID, who referred the customer making the purchase.

Example:

cust_7iUa6ICKyU6gH40dBU25kQU1

object
string

Type of object represented by the referrer object.

| +| customer_id
`string` |

Unique customer ID of the customer making the purchase.

**Example:**

cust_7iUa6ICKyU6gH40dBU25kQU1

| +| referrer_id
`string` |

Unique referrer ID.

**Example:**

cust_nM4jqPiaXUvQdVSA6vTRUnix

| +| object
`string` |

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

| +| redemptions |

Lists details related to the redemption.

See: [Unstacked Redemption](#unstacked-redemption) | + +## Category Object +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique category ID assigned by Voucherify.

| +| name
`string` |

Category name.

| +| hierarchy
`integer` |

Category hierarchy.

| +| created_at
`string` |

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

**Example:**

2022-07-14T10:45:13.156Z

| +| 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.

| + +## Amount +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Applies an amount discount.

| +| amount_off
`integer` |

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.

**Example:**

100

| +| amount_off_formula
`string` |

Formula used to calculate the discount.

| +| aggregated_amount_limit
`integer` |

Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects:

| +| effect
`string` |

Defines how the discount is applied to the customer's order. The discount effects are defined as follows:

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS`, `APPLY_TO_ITEMS_PROPORTIONALLY`, `APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY`, `APPLY_TO_ITEMS_BY_QUANTITY` | + +## Percentage +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Applies a percentage discount.

| +| amount_limit
`string` |

Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.

| +| aggregated_amount_limit
`integer` |

Maximum discount amount per order. This value is definable for the APPLY_TO_ITEMS discount effect. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600.

| +| percent_off
`integer` |

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.

| +| percent_off_formula
`string` |

Formula used to calculate the discount.

| +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | + +## Fixed +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Sets a fixed total on cart or item(s) and then calculates the discount to apply.

| +| fixed_amount
`integer` |

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

| +| fixed_amount_formula
`string` |

Formula used to calculate the discounted price of an item or a new order total.

| +| effect
`string` |
EffectDefinition
APPLY_TO_ORDERSets 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.
APPLY_TO_ITEMSSets 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.
Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | + +## Unit, single item +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Applies a full value discount to item(s).

| +| unit_off
`number` |

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
`string` |

Formula used to calculate the number of units.

| +| unit_type
`string` |

The product deemed as free, chosen from the product inventory (e.g. time, items).

**Example:**

prod_f1r5Tpr0DuC7

| +| effect
`string` |

Defines how the unit is added to the customer's order.

Available values: `ADD_NEW_ITEMS`, `ADD_MISSING_ITEMS` | + +## Unit, multiple items +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Applies a full value discount to item(s).

| +| effect
`string` |

Defines the effect for adding multiple item types.

| +| units
`array` |

Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.

Array of:
AttributesDescription
unit_off
integer

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
string

Formula used to calculate the number of units.

unit_type
string

The product deemed as free, chosen from the product inventory (e.g. time, items).

Example:

prod_f1r5Tpr0DuC7

effect
string

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS
| + +## Shipping +| Attributes | Description | +|:-----|:--------| +| type
`string` |

Applies a full value discount to item(s).

| +| unit_off
`number` |

Subtracts 1 shipping item from the subtotal.

| +| unit_type
`string` |

The shipping product deemed as free.

| +| effect
`string` |

Defines how the unit is added to the customer's order.

| + +## Product Object +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique product ID.

**Example:**

prod_f1r5Tpr0DuC7

| +| source_id
`string` |

Unique product source ID.

**Example:**

productSourceID16

| +| name
`string` |

Unique user-defined product name.

**Example:**

T-shirt

| +| price
`integer` |

Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

| +| attributes
`array` |

A list of product attributes whose values you can customize for given SKUs: ["color","size","ranking"]. Each child SKU can have a unique value for a given attribute.

| +| metadata
`object` |

The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format.

| +| image_url
`string` |

The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.

**Example:**

https://images.com/original.jpg

| +| created_at
`string` |

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

**Example:**

2022-05-23T06:52:55.008Z

| +| updated_at
`string` |

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

**Example:**

2022-05-23T09:24:07.405Z

| +| object
`string` |

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

| + +## SKU Object +| Attributes | Description | +|:-----|:--------| +| id
`string` |

A unique identifier that represents the SKU and is assigned by Voucherify.

**Example:**

sku_0b1621b319d248b79f

| +| source_id
`string` |

A unique SKU identifier from your inventory system.

**Example:**

sku_source_id_4

| +| product_id
`string` |

The parent product's unique ID.

**Example:**

prod_0b15f6b9f650c16990

| +| sku
`string` |

Unique user-defined SKU name.

**Example:**

Large Pink Shirt

| +| price
`integer` |

SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.

| +| currency
`string` |

SKU price currency.

**Example:**

USD

| +| attributes
`object` |

The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family.

| +| image_url
`string` |

The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image.

| +| metadata
`object` |

The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format.

| +| created_at
`string` |

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

**Example:**

2022-05-17T10:36:30.187Z

| +| updated_at
`string` |

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

**Example:**

2022-05-17T10:55:09.137Z

| +| object
`string` |

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

| + +## Discount Voucher +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique parent campaign ID of reward.

**Example:**

camp_0dJG7cCAjquzcxWmZ634bA0C

| +| type
`string` |

Campaign type.

Available values: `DISCOUNT_COUPONS` | + +## Gift Card +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique parent campaign ID of reward.

**Example:**

camp_0dJG7cCAjquzcxWmZ634bA0C

| +| balance
`integer` |

The amount credited to the gift card as a reward expressed as the smallest currency unit (that is, 100 cents for $1.00).

| +| type
`string` |

Campaign type.

Available values: `GIFT_VOUCHERS` | + +## Loyalty Card +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Unique parent campaign ID of reward.

**Example:**

camp_0dJG7cCAjquzcxWmZ634bA0C

| +| balance
`integer` |

The number of loyalty points that is added to the loyalty card as a reward.

| +| type
`string` |

Campaign type.

Available values: `LOYALTY_PROGRAM` | + +## Validation Rule Assignments +| Attributes | Description | +|:-----|:--------| +| 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) | +| total
`integer` |

Total number of validation rule assignments.

| + +## Unstacked Redemption +| Attributes | Description | +|:-----|:--------| +| 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 +| Attributes | Description | +|:-----|:--------| +| id
`string` |

Validation rule assignment ID.

**Example:**

asgm_74F7QZoYbUoljwQO

| +| rule_id
`string` |

Validation rule ID.

**Example:**

val_4j7DCRm2IS59

| +| 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.

| + [block:html] { "html": "" diff --git a/docs/reference-docs/VALIDATIONS-API-Validation-Object.md b/docs/reference-docs/VALIDATIONS-API-Validation-Object.md index 565f9915a..f6d434075 100644 --- a/docs/reference-docs/VALIDATIONS-API-Validation-Object.md +++ b/docs/reference-docs/VALIDATIONS-API-Validation-Object.md @@ -70,7 +70,7 @@ Any of: ## Included Items | Attributes | Description | |:-----|:--------| -| data
`array` |

Contains array of items to which the discount can apply.

| +| data
`array` |

Contains array of items to which the discount can apply.

Array any of: [Product Collection](#product-collection), [Product Collection for Unit Discount](#product-collection-for-unit-discount), [Product Collection for Fixed Amount Discount](#product-collection-for-fixed-amount-discount), [Product](#product), [Product for Unit Discount](#product-for-unit-discount), [Product for Fixed Amount Discount](#product-for-fixed-amount-discount), [SKU](#sku), [SKU for Unit Discount](#sku-for-unit-discount), [SKU for Amount Discount](#sku-for-amount-discount) | | total
`integer` |

Total number of objects defining included products, SKUs, or product collections.

| | data_ref
`string` |

Identifies the name of the attribute that contains the array of included objects.

| | object
`string` |

The type of object represented by JSON. This object stores information about included products, SKUs, or product collections in a dictionary.

| @@ -78,7 +78,7 @@ Any of: ## Excluded Items | Attributes | Description | |:-----|:--------| -| data
`array` |

Contains array of items to which the discount cannot apply.

| +| data
`array` |

Contains array of items to which the discount cannot apply.

Array any of: [Product Collection](#product-collection), [Product](#product), [SKU](#sku) | | total
`integer` |

Total number of objects defining excluded products, SKUs, or product collections.

| | data_ref
`string` |

Identifies the name of the attribute that contains the array of excluded objects.

| | object
`string` |

The type of object represented by JSON. This object stores information about excluded products, SKUs, or product collections in a dictionary.

| @@ -182,6 +182,128 @@ One of: | ttl_unit
`string` |

Defines the type of unit in which the session time is counted.

Available values: `HOURS`, `DAYS`, `MINUTES`, `SECONDS`, `MILLISECONDS`, `MICROSECONDS`, `NANOSECONDS` | | ttl
`integer` |

Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter.

| +## Product Collection +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product collection.

| +| id
`string` |

Unique product collection ID assigned by Voucherify.

**Example:**

pc_4ndRXAsTOzwSdHcQcxf489uU

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## Product Collection for Unit Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product collection.

| +| id
`string` |

Unique product collection ID assigned by Voucherify.

**Example:**

pc_4ndRXAsTOzwSdHcQcxf489uU

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | +| quantity_limit
`integer` |

The maximum number of units allowed to be discounted per order line item.

| +| aggregated_quantity_limit
`integer` |

The maximum number of units allowed to be discounted combined across all matched order line items.

| + +## Product Collection for Fixed Amount Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product collection.

| +| id
`string` |

Unique product collection ID assigned by Voucherify.

**Example:**

pc_4ndRXAsTOzwSdHcQcxf489uU

| +| strict
`boolean` | | +| price
`integer` |

New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price.

| +| price_formula
`string` |

Formula used to calculate the discounted price of an item.

**Example:**

"IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)

| +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## Product +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product.

| +| id
`string` |

Unique product ID assigned by Voucherify.

**Example:**

prod_0bae2dc5a090fd0184

| +| source_id
`string` |

The product ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## Product for Unit Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product.

| +| id
`string` |

Unique product ID assigned by Voucherify.

**Example:**

prod_0bae2dc5a090fd0184

| +| source_id
`string` |

The product ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | +| quantity_limit
`integer` |

The maximum number of units allowed to be discounted per order line item.

| +| aggregated_quantity_limit
`integer` |

The maximum number of units allowed to be discounted combined across all matched order line items.

| + +## Product for Fixed Amount Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product.

| +| id
`string` |

Unique product ID assigned by Voucherify.

**Example:**

prod_0bae2dc5a090fd0184

| +| source_id
`string` |

The product ID from your inventory system.

| +| strict
`boolean` | | +| price
`integer` |

New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price.

| +| price_formula
`string` |

Formula used to calculate the discounted price of an item.

**Example:**

IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)

| +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## SKU +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product variant.

| +| id
`string` |

Unique SKU ID assigned by Voucherify.

**Example:**

sku_0b7d7dfb090be5c619

| +| source_id
`string` |

The source ID from your inventory system.

| +| product_id
`string` |

Parent product's unique ID assigned by Voucherify.

| +| product_source_id
`string` |

Parent product's source ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## SKU for Unit Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product variant.

| +| id
`string` |

Unique SKU ID assigned by Voucherify.

**Example:**

sku_0b7d7dfb090be5c619

| +| source_id
`string` |

The source ID from your inventory system.

| +| product_id
`string` |

Parent product's unique ID assigned by Voucherify.

| +| product_source_id
`string` |

Parent product's source ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | +| quantity_limit
`integer` |

The maximum number of units allowed to be discounted per order line item.

| +| aggregated_quantity_limit
`integer` |

The maximum number of units allowed to be discounted combined across all matched order line items.

| + +## SKU for Amount Discount +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product variant.

| +| id
`string` |

Unique SKU ID assigned by Voucherify.

**Example:**

sku_0b7d7dfb090be5c619

| +| source_id
`string` |

The source ID from your inventory system.

| +| product_id
`string` |

Parent product's unique ID assigned by Voucherify.

| +| product_source_id
`string` |

Parent product's source ID from your inventory system.

| +| strict
`boolean` | | +| price
`integer` |

New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the price_formula parameter is present in the fixed price definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price.

| +| price_formula
`string` |

Formula used to calculate the discounted price of an item.

**Example:**

IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.2;6)

| +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY`, `APPLY_TO_CHEAPEST`, `APPLY_TO_MOST_EXPENSIVE` | + +## Product Collection +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product collection.

| +| id
`string` |

Unique product collection ID assigned by Voucherify.

**Example:**

pc_4ndRXAsTOzwSdHcQcxf489uU

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY` | + +## Product +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This product stores information about the product.

| +| id
`string` |

Unique product ID assigned by Voucherify.

**Example:**

prod_0bae2dc5a090fd0184

| +| source_id
`string` |

The product ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY` | + +## SKU +| Attributes | Description | +|:-----|:--------| +| object
`string` |

This object stores information about the product variant.

| +| id
`string` |

Unique SKU ID assigned by Voucherify.

**Example:**

sku_0b7d7dfb090be5c619

| +| source_id
`string` |

The source ID from your inventory system.

| +| strict
`boolean` | | +| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_EVERY` | + ## Order object - Effect: Apply to items | Attributes | Description | |:-----|:--------| diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 188cadc3a..246dd8f89 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -39240,172 +39240,7 @@ } } }, - "LoyaltiesCreateTiersRequestBody": { - "title": "LoyaltiesCreateTiersRequestBody", - "x-stoplight": { - "id": "i1emmwlaqp7lt" - }, - "type": "array", - "items": { - "$ref": "#/components/schemas/CreateLoyaltyTier" - } - }, - "LoyaltiesCreateTiersResponseBody": { - "title": "LoyaltiesCreateTiersResponseBody", - "x-stoplight": { - "id": "ix7g5mnuwqsp6" - }, - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "LoyaltiesGetRewardAssignmentResponseBody": { - "$ref": "#/components/schemas/RewardAssignment", - "x-stoplight": { - "id": "fnbbaq9l1l9it" - } - }, - "LoyaltiesGetRewardDetailsResponseBody": { - "$ref": "#/components/schemas/Reward", - "x-stoplight": { - "id": "44hds9u0hhukf" - } - }, - "LoyaltiesListTiersRequestQuery": { - "title": "LoyaltiesListTiersRequestQuery", - "x-stoplight": { - "id": "d5sluzqkxu8km" - }, - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." - }, - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ], - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - } - }, - "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { - "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", - "x-stoplight": { - "id": "zs0z1cyyzac9u" - }, - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." - } - } - }, - "LoyaltiesGetTierResponseBody": { - "$ref": "#/components/schemas/LoyaltyTier", - "x-stoplight": { - "id": "hzcsijl2b4d5o" - } - }, - "LoyaltiesListTiersResponseBody": { - "title": "LoyaltiesListTiersResponseBody", - "x-stoplight": { - "id": "kw06g2szvv479" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltiesListMemberLoyaltyTiersResponseBody": { - "title": "LoyaltiesListMemberLoyaltyTiersResponseBody", - "x-stoplight": { - "id": "s3zpgud510xl6" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "EarningRule": { + "LoyaltiesGetEarningRuleResponseBody": { "allOf": [ { "$ref": "#/components/schemas/EarningRuleBase" @@ -39441,461 +39276,411 @@ } ] }, - "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { - "title": "LoyaltiesListLoyaltyTierEarningRulesResponseBody", - "x-stoplight": { - "id": "i180zbh3ffwaa" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of earning rule objects.", - "items": { - "$ref": "#/components/schemas/EarningRule" - } + "LoyaltiesEnableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." + { + "type": "object", + "properties": { + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." + }, + "active": { + "type": "boolean", + "default": true, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + } + }, + "required": [ + "updated_at", + "active" + ] } - }, - "required": [ - "object", - "data_ref", - "data", - "total" ] }, - "CreateLoyaltyTier": { - "title": "CreateLoyaltyTier", - "x-stoplight": { - "id": "xpsiqbhyf58t7" - }, - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "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.\n\n" - }, - "earning_rules": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" - }, - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." - }, - "rewards": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" - }, - "description": "Contains a list of reward IDs and their points mapping for the given reward." + "LoyaltiesDisableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" }, - "points": { + { "type": "object", - "description": "Defines range of loyalty tier in points.", "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." }, - "to": { - "type": "integer", - "description": "Top points threshold value." + "active": { + "type": "boolean", + "default": false, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." } - } + }, + "required": [ + "updated_at", + "active" + ] } - }, - "required": [ - "name", - "points" ] }, - "LoyaltyTier": { - "title": "LoyaltyTier", + "EarningRuleBase": { + "title": "EarningRuleBase", "x-stoplight": { - "id": "ed25x9e2fu5od" + "id": "w4ci1ljqva0r1" }, "type": "object", "properties": { "id": { "type": "string", - "description": "Unique loyalty tier ID." - }, - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "campaign_id": { - "type": "string", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + "description": "Assigned by the Voucherify API, identifies the earning rule object." }, "created_at": { "type": "string", "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + "loyalty": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleFixed" + }, + { + "$ref": "#/components/schemas/EarningRuleProportional" + } + ] }, - "earning_rules": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" - }, - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." + "event": { + "$ref": "#/components/schemas/EarningRuleEvent", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card." }, - "rewards": { + "custom_event": { "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" + "properties": { + "schema_id": { + "type": "string" + } }, - "description": "Contains a list of reward IDs and their points mapping for the given reward." + "required": [ + "schema_id" + ] }, - "config": { + "segment": { "type": "object", - "required": [ - "points" - ], - "description": "Defines loyalty tier range in points.", + "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", "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." - } - } + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." } - } + }, + "required": [ + "id" + ] }, - "points": { + "source": { "type": "object", - "description": "Defines range of loyalty tier in points.", + "required": [ + "object_id", + "object_type" + ], + "description": "Contains the custom earning rule name and parent campaign.", "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "to": { - "type": "integer", - "description": "Top points threshold value." + "object_id": { + "type": "string", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", + "enum": [ + "campaign" + ] } } }, - "expiration": { + "object": { + "type": "string", + "enum": [ + "earning_rule" + ], + "description": "The type of object represented by JSON. Default is earning_rule." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify." + }, + "start_date": { + "type": "string", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { "type": "object", - "description": "Defines loyalty tier expiration date.", + "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": { - "customer_id": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "tier_id": { - "type": "string" - }, - "start_date": { - "type": "string", - "format": "date-time" - }, - "expiration_date": { - "type": "string", - "format": "date-time" - }, - "created_at": { + "duration": { "type": "string", - "format": "date-time" + "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." }, - "updated_at": { + "interval": { "type": "string", - "format": "date-time" + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." } }, "required": [ - "customer_id", - "campaign_id", - "tier_id", - "created_at" + "duration", + "interval" ] }, - "object": { - "type": "string", - "enum": [ - "loyalty_tier" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty." + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } }, "required": [ "id", - "name", - "campaign_id", - "metadata", "created_at", - "config", - "points", - "object" + "loyalty", + "source", + "object", + "automation_id", + "metadata" ] }, - "MappingMultiply": { - "title": "MappingMultiply", + "EarningRuleEvent": { + "title": "EarningRuleEvent", "x-stoplight": { - "id": "7zrwgr2oqh4tj" + "id": "6vxql7fnzg2zp" }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "MULTIPLY" - ], - "description": "Type of calculation." - }, - "multiplier": { - "type": "number", - "description": "Multiplication factor used to multiply the points to obtain the mapped points." - } - } + "type": "string", + "enum": [ + "order.paid", + "customer.segment.entered", + "custom_event", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged", + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left" + ] }, - "MappingFixed": { - "title": "MappingFixed", + "EarningRuleFixed": { + "title": "Define fixed amount of points", "x-stoplight": { - "id": "86eksegayxcxa" + "id": "r5o8m0sdli7fq" }, "type": "object", "properties": { "type": { "type": "string", "enum": [ - "CUSTOM" + "FIXED" ], - "description": "Type of calculation.\n\n" + "description": "The number of points to be added to the loyalty card." }, "points": { "type": "integer", - "description": "Fixed number of points to be applied." + "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." } } }, - "RewardAssignment": { - "title": "Reward Assignment", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique reward assignment ID, assigned by Voucherify." + "EarningRuleProportionalOrder": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" }, - "reward_id": { - "type": "string", - "description": "Associated reward ID." + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" }, - "related_object_id": { + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" + } + ], + "title": "Order" + }, + "EarningRuleProportionalOrderAmount": { + "title": "Order Amount", + "x-stoplight": { + "id": "1z7lk7z1lp5af" + }, + "type": "object", + "properties": { + "type": { "type": "string", - "description": "Related object ID to which the reward was assigned." + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "related_object_type": { + "calculation_type": { "type": "string", - "description": "Related object type to which the reward was assigned." + "enum": [ + "ORDER_AMOUNT" + ], + "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" }, - "parameters": { + "order": { "type": "object", - "description": "Defines the cost of the reward.", + "required": [ + "amount" + ], "properties": { - "loyalty": { + "amount": { "type": "object", - "description": "Defines the equivalent points value of the reward.", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, "points": { "type": "integer", - "description": "The number of points required to redeem the reward." + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } - }, - "required": [ - "points" - ] + } } } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." } }, "required": [ - "id", - "reward_id", - "created_at", - "object" + "type", + "calculation_type", + "order" ] }, - "Reward": { - "allOf": [ - { + "EarningRuleProportionalOrderTotalAmount": { + "title": "Order Total Amount", + "x-stoplight": { + "id": "ekudxr430edgk" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_TOTAL_AMOUNT" + ], + "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + }, + "order": { "type": "object", + "required": [ + "total_amount" + ], "properties": { - "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": { + "total_amount": { "type": "object", - "description": "These properties are configurable for material rewards.", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } } - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "reward", - "pattern": "reward", - "description": "The type of object represented by the JSON. This object stores information about the reward." } - }, - "required": [ - "id", - "created_at", - "object" - ] - }, - { - "$ref": "#/components/schemas/RewardType" - } - ] - }, - "RewardType": { - "title": "Reward Type", - "anyOf": [ - { - "$ref": "#/components/schemas/RewardTypeCampaign" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - } - ] - }, - "MappingPoints": { - "anyOf": [ - { - "$ref": "#/components/schemas/MappingMultiply" - }, - { - "$ref": "#/components/schemas/MappingFixed" + } } + }, + "required": [ + "type", + "calculation_type", + "order" ] }, - "RewardTypeCoin": { - "title": "Reward Type Coin", + "EarningRuleProportionalOrderMetadata": { + "title": "Order Metadata", + "x-stoplight": { + "id": "4ccw4gz8b47u5" + }, "type": "object", "properties": { "type": { "type": "string", "enum": [ - "COIN" + "PROPORTIONAL" ], - "description": "Reward type." + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "parameters": { + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_METADATA" + ], + "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" + }, + "order": { "type": "object", "required": [ - "coin" + "metadata" ], - "description": "Defines how the reward is generated.", + "description": "Defines the formula for calculating points proportionally.", "properties": { - "coin": { + "metadata": { "type": "object", "required": [ - "exchange_ratio" + "every", + "points", + "property" ], - "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", "properties": { - "exchange_ratio": { - "type": "number", - "description": "The cash equivalent of the points defined in the points_ratio property." + "every": { + "type": "integer", + "description": "For how many increments of the order metadata property to grant points for." }, - "points_ratio": { + "points": { "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "Order metadata property." } } } @@ -39904,45 +39689,67 @@ }, "required": [ "type", - "parameters" + "calculation_type", + "order" ] }, - "RewardTypeMaterial": { - "title": "Reward Type Material", + "EarningRuleProportionalOrderItemsQuantity": { + "title": "Order Items Quantity", + "x-stoplight": { + "id": "pqsn9otpzyot9" + }, "type": "object", "properties": { "type": { "type": "string", "enum": [ - "MATERIAL" + "PROPORTIONAL" ], - "description": "Reward type." + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "parameters": { + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_QUANTITY" + ], + "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" + }, + "order_items": { "type": "object", "required": [ - "product" + "quantity" ], - "description": "Defines how the reward is generated.", "properties": { - "product": { + "quantity": { "type": "object", "required": [ - "id", - "sku" + "every", + "points", + "object", + "id" ], - "description": "Contains information about the product given as a reward.", + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", "properties": { - "id": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { "type": "string", - "description": "Unique product ID, assigned by Voucherify." + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] }, - "sku": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } } } @@ -39951,52 +39758,67 @@ }, "required": [ "type", - "parameters" + "calculation_type", + "order_items" ] }, - "RewardTypeCampaign": { - "title": "Reward Type Campaign", + "EarningRuleProportionalOrderItemsAmount": { + "title": "Order Items Amount", + "x-stoplight": { + "id": "8pg4o23daepkb" + }, "type": "object", "properties": { "type": { "type": "string", "enum": [ - "CAMPAIGN" + "PROPORTIONAL" ], - "description": "Reward type." + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "parameters": { + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_AMOUNT" + ], + "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" + }, + "order_items": { "type": "object", "required": [ - "campaign" + "amount" ], - "description": "Defines how the reward is generated.", "properties": { - "campaign": { + "amount": { "type": "object", "required": [ - "id", - "type" + "every", + "points", + "object", + "id" ], - "description": "Objects stores information about the campaign related to the reward.", + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify." + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - "balance": { + "points": { "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." + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "type": { + "object": { "type": "string", + "description": "Type of object taken under consideration.", "enum": [ - "DISCOUNT_COUPONS", - "PROMOTION", - "GIFT_VOUCHERS", - "REFERRAL_PROGRAM" - ], - "description": "Campaign type." + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } } } @@ -40005,751 +39827,1400 @@ }, "required": [ "type", - "parameters" + "calculation_type", + "order_items" ] }, - "LoyaltiesGetEarningRuleResponseBody": { - "$ref": "#/components/schemas/EarningRule" - }, - "LoyaltiesEnableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" + "EarningRuleProportionalOrderItemsSubtotalAmount": { + "title": "Order Items Subtotal Amount", + "x-stoplight": { + "id": "duxy5qw36h5ph" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - { + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_SUBTOTAL_AMOUNT" + ], + "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" + }, + "order_items": { "type": "object", + "required": [ + "subtotal_amount" + ], "properties": { - "updated_at": { - "type": [ - "string", - "null" + "subtotal_amount": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": true, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + } + } } - }, - "required": [ - "updated_at", - "active" - ] + } } + }, + "required": [ + "type", + "calculation_type", + "order_items" ] }, - "LoyaltiesDisableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" + "EarningRuleProportionalCustomerMetadata": { + "title": "Customer Metadata", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - { + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" + }, + "customer": { "type": "object", + "required": [ + "metadata" + ], "properties": { - "updated_at": { - "type": [ - "string", - "null" + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": false, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "Customer metadata property." + } + } } - }, - "required": [ - "updated_at", - "active" - ] + } } + }, + "required": [ + "type", + "calculation_type", + "customer" ] }, - "EarningRuleBase": { - "title": "EarningRuleBase", + "EarningRuleProportionalCustomEvent": { + "title": "Custom Event", "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "Assigned by the Voucherify API, identifies the earning rule object." + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "created_at": { + "calculation_type": { "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." - }, - "loyalty": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleFixed" - }, - { - "$ref": "#/components/schemas/EarningRuleProportional" - } - ] - }, - "event": { - "$ref": "#/components/schemas/EarningRuleEvent", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card." + "enum": [ + "CUSTOM_EVENT_METADATA" + ], + "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." }, "custom_event": { - "type": "object", - "properties": { - "schema_id": { - "type": "string" - } - }, - "required": [ - "schema_id" - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - }, - "required": [ - "id" - ] - }, - "source": { "type": "object", "required": [ - "object_id", - "object_type" + "metadata" ], - "description": "Contains the custom earning rule name and parent campaign.", "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", - "enum": [ - "campaign" - ] - } - } - }, - "object": { - "type": "string", - "enum": [ - "earning_rule" - ], - "description": "The type of object represented by JSON. Default is earning_rule." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify." - }, - "start_date": { - "type": "string", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "\nCustom event metadata property." + } + } } - }, - "required": [ - "duration", - "interval" - ] - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } }, "required": [ - "id", - "created_at", - "loyalty", - "source", - "object", - "automation_id", - "metadata" - ] - }, - "EarningRuleEvent": { - "title": "EarningRuleEvent", - "type": "string", - "enum": [ - "order.paid", - "customer.segment.entered", - "custom_event", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged", - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left" + "type", + "calculation_type", + "custom_event" ] }, - "EarningRuleFixed": { - "title": "Define fixed amount of points", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "FIXED" - ], - "description": "The number of points to be added to the loyalty card." + "EarningRuleProportional": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrder" }, - "points": { - "type": "integer", - "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" } - } + ], + "title": "Calculate points proportionally" }, - "EarningRuleProportionalOrder": { + "EarningRuleProportionalOrderItems": { "anyOf": [ { - "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" }, { - "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" }, { - "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" } ], - "title": "Order" + "title": "Order Items" }, - "EarningRuleProportionalOrderAmount": { - "title": "Order Amount", + "LoyaltiesGetPointsExpirationResponseBody": { + "title": "Loyalties Get Points Expiration Response Body", "type": "object", "properties": { - "type": { + "object": { "type": "string", + "pattern": "list", "enum": [ - "PROPORTIONAL" + "list" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." }, - "calculation_type": { + "data_ref": { "type": "string", + "pattern": "data", "enum": [ - "ORDER_AMOUNT" + "data" ], - "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." }, - "order": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty points bucket ID." + }, + "voucher_id": { + "type": "string", + "description": "Unique parent loyalty card ID." + }, + "campaign_id": { + "type": "string", + "description": "\nUnique parent campaign ID." + }, + "bucket": { + "type": "object", + "required": [ + "total_points" + ], + "description": "Defines the number of points stored in the given loyalty points bucket.", + "properties": { + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." + } } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Date when the number of points defined in the bucket object are due to expire." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "pattern": "loyalty_points_bucket", + "enum": [ + "loyalty_points_bucket" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." } - } + }, + "required": [ + "id", + "voucher_id", + "campaign_id", + "bucket", + "created_at", + "status", + "expires_at", + "object" + ] } + }, + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." } }, "required": [ - "type", - "calculation_type", - "order" + "object", + "data_ref", + "data", + "total" ] }, - "EarningRuleProportionalOrderTotalAmount": { - "title": "Order Total Amount", + "LoyaltiesListCardTransactionsResponseBody": { + "title": "Loyalties List Card Transactions Response Body", "type": "object", "properties": { - "type": { + "object": { "type": "string", + "pattern": "list", "enum": [ - "PROPORTIONAL" + "list" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "description": "The type of object represented by JSON." }, - "calculation_type": { + "data_ref": { "type": "string", + "pattern": "data", "enum": [ - "ORDER_TOTAL_AMOUNT" + "data" ], - "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + "description": "Identifies the name of the attribute that contains the array of transaction objects." }, - "order": { - "type": "object", - "required": [ - "total_amount" - ], - "properties": { - "total_amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } + "data": { + "type": "array", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransaction" } + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." } }, "required": [ - "type", - "calculation_type", - "order" + "object", + "data_ref", + "data", + "has_more" ] }, - "EarningRuleProportionalOrderMetadata": { - "title": "Order Metadata", + "LoyaltyCardTransactionsType": { + "type": "string", + "enum": [ + "POINTS_ACCRUAL", + "POINTS_CANCELLATION", + "POINTS_REDEMPTION", + "POINTS_REFUND", + "POINTS_ADDITION", + "POINTS_REMOVAL", + "POINTS_EXPIRATION", + "POINTS_TRANSFER_IN", + "POINTS_TRANSFER_OUT" + ] + }, + "SimpleLoyaltyVoucher": { + "title": "Simple Loyalty Voucher", "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "id": { + "type": "string" }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_METADATA" - ], - "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" + "code": { + "type": "string" }, - "order": { + "loyalty_card": { "type": "object", "required": [ - "metadata" + "points", + "balance" ], - "description": "Defines the formula for calculating points proportionally.", "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the order metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Order metadata property." - } - } + "points": { + "type": "string" + }, + "balance": { + "type": "string" + }, + "next_expiration_date": { + "type": "string" + }, + "next_expiration_points": { + "type": "string" } } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ] + }, + "campaign": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "is_referral_code": { + "type": "boolean" + }, + "holder_id": { + "type": "string" + }, + "referrer_id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "object": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ] } }, "required": [ + "id", + "code", + "loyalty_card", "type", - "calculation_type", - "order" + "campaign", + "campaign_id", + "object" ] }, - "EarningRuleProportionalOrderItemsQuantity": { - "title": "Order Items Quantity", + "LoyaltyCardTransaction": { + "title": "Loyalty Card Transaction", "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "PROPORTIONAL" + "description": "Unique transaction ID." + }, + "source_id": { + "type": [ + "string", + "null" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "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." }, - "calculation_type": { + "voucher_id": { "type": "string", - "enum": [ - "ORDER_ITEMS_QUANTITY" + "description": "Unique voucher ID." + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes." + }, + "source": { + "type": [ + "string", + "null" ], - "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" + "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." }, - "order_items": { - "type": "object", - "required": [ - "quantity" + "reason": { + "type": [ + "string", + "null" ], + "description": "Reason why the transaction occurred. In case of a redemption, this value is null." + }, + "type": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsType", + "description": "Type of transaction." + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", "properties": { - "quantity": { + "balance": { "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + "type": { + "type": "string", + "pattern": "loyalty_card", + "enum": [ + "loyalty_card" + ], + "description": "The type of voucher whose balance is being adjusted due to the transaction." }, - "points": { + "total": { "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + "description": "The available points prior to the transaction." }, "object": { "type": "string", - "description": "Type of object taken under consideration.", + "pattern": "balance", "enum": [ - "products_collection", - "product", - "sku" - ] + "balance" + ], + "description": "The type of object represented by the JSON." }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + "points": { + "type": "integer", + "description": "The amount of points being used up in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "required": [ + "id", + "type" + ], + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API." + }, + "type": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ], + "description": "The object being modified, i.e. voucher." + } + } } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalOrderItemsAmount": { - "title": "Order Items Amount", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_AMOUNT" - ], - "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" - }, - "order_items": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", + }, "required": [ - "every", - "points", + "type", + "total", "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "points", + "balance", + "related_object" + ] + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + "id": { + "type": "string", + "description": "Unique order ID." }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + }, + "required": [ + "id", + "source_id" + ] + }, + "event": { + "type": "object", + "description": "Contains information about the event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." }, - "object": { + "type": { "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] + "description": "Type of event." + } + }, + "required": [ + "id", + "type" + ] + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID." + }, + "source": { + "type": "object", + "required": [ + "banner" + ], + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + } + }, + "required": [ + "id", + "source" + ] + }, + "segment": { + "type": "object", + "description": "Contains information about the segment.", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Contains information about the loyalty tier.", + "properties": { + "id": { + "type": "string" }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { "id": { "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + "description": "Unique redemption ID." } - } + }, + "required": [ + "id" + ] + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID." + } + }, + "required": [ + "id" + ] + }, + "custom_event": { + "type": "object", + "description": "Contains information about the custom event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." + }, + "type": { + "type": "string", + "description": "Type of custom event." + } + }, + "required": [ + "id", + "type" + ] + }, + "event_schema": { + "type": "object", + "description": "Contains information about the custom event metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID." + }, + "name": { + "type": "string", + "description": "Type of custom event." + } + }, + "required": [ + "id", + "name" + ] + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID." + }, + "name": { + "type": "string", + "description": "Reward name." + } + }, + "required": [ + "id", + "name" + ] + }, + "source_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction." + }, + "destination_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction." } } + }, + "related_transaction_id": { + "type": [ + "string", + "null" + ], + "description": "The related transaction ID on the receiving card." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format.\n\n" } }, "required": [ + "id", + "source_id", + "voucher_id", + "campaign_id", + "source", + "reason", "type", - "calculation_type", - "order_items" + "details", + "related_transaction_id", + "created_at" ] }, - "EarningRuleProportionalOrderItemsSubtotalAmount": { - "title": "Order Items Subtotal Amount", + "LoyaltyCardTransactionsFields": { + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "LoyaltiesExportCardTransactionsRequestBody": { + "title": "Loyalties Export Card Transactions Request Body", "type": "object", "properties": { - "type": { + "order": { "type": "string", "enum": [ - "PROPORTIONAL" + "created_at", + "-created_at" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "calculation_type": { + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + } + } + }, + "LoyaltiesExportCardTransactionsResponseBody": { + "title": "Loyalties Export Card Transactions Response Body", + "type": "object", + "description": "", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { "type": "string", + "pattern": "export", "enum": [ - "ORDER_ITEMS_SUBTOTAL_AMOUNT" + "export" ], - "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" + "description": "The type of object being represented. This object stores information about the export." }, - "order_items": { + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "pattern": "SCHEDULED", + "enum": [ + "SCHEDULED" + ], + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "exported_object": { + "type": "string", + "pattern": "voucher_transactions", + "enum": [ + "voucher_transactions" + ], + "description": "The type of exported object." + }, + "parameters": { "type": "object", "required": [ - "subtotal_amount" + "filters" ], + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", "properties": { - "subtotal_amount": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + }, + "filters": { "type": "object", "required": [ - "every", - "points", - "object", - "id" + "voucher_id" ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "description": "Filter condition.", "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + "voucher_id": { + "type": "object", + "required": [ + "conditions" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "required": [ + "$in" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 1 + } + } + } + } + } } } } } + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." } }, "required": [ - "type", - "calculation_type", - "order_items" + "id", + "object", + "created_at", + "status", + "channel", + "exported_object", + "parameters", + "result", + "user_id" ] }, - "EarningRuleProportionalCustomerMetadata": { - "title": "Customer Metadata", + "LoyaltiesAddOrRemoveCardBalanceResponseBody": { + "title": "Loyalties Add Or Remove Card Balance Response Body", "type": "object", + "description": "Response schema for adding or removing points from a loyalty card.", "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "minimum": 0, + "description": "The balance after adding/removing points." + }, "type": { "type": "string", "enum": [ - "PROPORTIONAL" + "LOYALTY_CARD", + "GIFT_VOUCHER" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "description": "The type of voucher being modified." }, - "calculation_type": { + "object": { "type": "string", + "pattern": "balance", "enum": [ - "CUSTOMER_METADATA" + "balance" ], - "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" + "description": "The type of object represented by JSON. Default is balance." }, - "customer": { + "related_object": { "type": "object", "required": [ - "metadata" + "type", + "id" ], + "description": "Defines the object that is being modified with the values that are returned in the balance object.", "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" + "type": { + "type": "string", + "enum": [ + "voucher" ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Customer metadata property." - } - } + "description": "The object being modified." + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." } } + }, + "operation_type": { + "type": "string", + "enum": [ + "MANUAL", + "AUTOMATIC" + ] } }, "required": [ + "points", + "total", + "balance", "type", - "calculation_type", - "customer" + "object", + "related_object" ] }, - "EarningRuleProportionalCustomEvent": { - "title": "Custom Event", + "LoyaltiesTransferPointsResponseBody": { + "title": "Loyalties Transfer Points Response Body", "type": "object", "properties": { - "type": { + "id": { "type": "string", - "enum": [ - "PROPORTIONAL" + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": [ + "string", + "null" ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." }, - "calculation_type": { + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Unique category ID assigned by Voucherify." + }, + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Category" + } + }, + "type": { "type": "string", "enum": [ - "CUSTOM_EVENT_METADATA" + "LOYALTY_CARD" ], - "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." + "description": "Defines the type of voucher." }, - "custom_event": { + "loyalty_card": { "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", "required": [ - "metadata" + "points", + "balance" ], "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" + "points": { + "type": "integer", + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": [ + "string", + "null" + ], + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", + "format": "date-time" + }, + "expiration_date": { + "type": [ + "string", + "null" + ], + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", + "format": "date-time" + }, + "validity_timeframe": { + "type": [ + "object", + "null" + ], + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." + }, + "duration": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": [ + "array", + "null" + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "count": { + "type": "integer", + "description": "Publication events counter." + }, + "entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string", + "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" + } + }, + "required": [ + "object" + ] + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "How many times a voucher can be redeemed. A null value means unlimited." + }, + "redeemed_points": { + "type": "integer", + "description": "Total loyalty points redeemed." + }, + "redeemed_quantity": { + "type": "integer", + "description": "How many times a voucher has already been redeemed." + }, + "redemption_entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" + } + }, + "required": [ + "quantity" + ] + }, + "active": { + "type": "string", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" + }, + "additional_info": { + "type": [ + "string", + "null" + ], + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + "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." }, - "property": { + "url": { "type": "string", - "description": "\nCustom event metadata property." + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" } } } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of voucher owner." + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" } }, "required": [ + "id", + "code", + "category", + "category_id", "type", - "calculation_type", - "custom_event" + "loyalty_card", + "start_date", + "expiration_date", + "validity_timeframe", + "validity_day_of_week", + "active", + "additional_info", + "metadata", + "is_referral_code", + "created_at" ] }, - "EarningRuleProportional": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrder" + "LoyaltiesTransferPoints": { + "title": "Loyalties Transfer Points", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" + "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)." }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" + "reason": { + "type": "string", + "description": "Reason for the transfer." }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" + "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." } - ], - "title": "Calculate points proportionally" + }, + "required": [ + "code", + "points", + "source_id" + ] }, - "EarningRuleProportionalOrderItems": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" + "LoyaltiesTransferPointsRequestBody": { + "title": "Loyalties Transfer Points Request Body", + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltiesTransferPoints" + } + }, + "LoyaltiesAddOrRemoveCardBalanceRequestBody": { + "title": "Loyalties Add Or Remove Card Balance Request Body", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" + "expiration_type": { + "$ref": "#/components/schemas/PointsExpirationTypes", + "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." } - ], - "title": "Order Items" + }, + "required": [ + "points" + ] + }, + "PointsExpirationTypes": { + "title": "Points Expiration Types", + "type": "string", + "enum": [ + "PROGRAM_RULES", + "CUSTOM_DATE", + "NON_EXPIRING" + ] + }, + "Category": { + "title": "Category", + "x-stoplight": { + "id": "4l87q60w8ta36" + }, + "type": "object", + "description": "This is an object representing a category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "enum": [ + "category" + ], + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object" + ] }, "LoyaltiesListMemberRewardsRequestQuery": { "title": "Loyalties List Member Rewards Request Query", @@ -41360,619 +41831,2588 @@ "details" ] }, - "LoyaltiesExportCardTransactionsRequestBody": { - "title": "Loyalties Export Card Transactions Request Body", + "LoyaltiesExportCardTransactionsRequestBody": { + "title": "Loyalties Export Card Transactions Request Body", + "type": "object", + "properties": { + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ], + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + } + } + }, + "LoyaltiesExportCardTransactionsResponseBody": { + "title": "Loyalties Export Card Transactions Response Body", + "type": "object", + "description": "", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "pattern": "export", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "pattern": "SCHEDULED", + "enum": [ + "SCHEDULED" + ], + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "exported_object": { + "type": "string", + "pattern": "voucher_transactions", + "enum": [ + "voucher_transactions" + ], + "description": "The type of exported object." + }, + "parameters": { + "type": "object", + "required": [ + "filters" + ], + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + }, + "filters": { + "type": "object", + "required": [ + "voucher_id" + ], + "description": "Filter condition.", + "properties": { + "voucher_id": { + "type": "object", + "required": [ + "conditions" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "required": [ + "$in" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 1 + } + } + } + } + } + } + } + } + } + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "channel", + "exported_object", + "parameters", + "result", + "user_id" + ] + }, + "RewardAssignment": { + "title": "Reward Assignment", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "reward_id": { + "type": "string" + }, + "related_object_id": { + "type": "string" + }, + "related_object_type": { + "type": "string" + }, + "parameters": { + "type": "object", + "properties": { + "loyalty": { + "type": "object", + "properties": { + "points": { + "type": "integer" + } + }, + "required": [ + "points" + ] + } + } + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "object": { + "type": "string" + } + }, + "required": [ + "id", + "reward_id", + "created_at", + "object" + ] + }, + "Reward": { + "title": "Reward", + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "stock": { + "type": "integer" + }, + "redeemed": { + "type": "integer" + }, + "attributes": { + "type": "object", + "properties": { + "image_url": { + "type": "string" + }, + "description": { + "type": "string" + } + } + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "string" + }, + "object": { + "type": "string", + "default": "reward", + "pattern": "reward" + } + }, + "required": [ + "id", + "created_at", + "object" + ] + }, + { + "$ref": "#/components/schemas/RewardType" + } + ] + }, + "RewardTypeCoin": { + "title": "Reward Type Coin", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "COIN" + ] + }, + "parameters": { + "type": "object", + "required": [ + "coin" + ], + "properties": { + "coin": { + "type": "object", + "required": [ + "exchange_ratio" + ], + "properties": { + "exchange_ratio": { + "type": "number" + }, + "points_ratio": { + "type": "integer" + } + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeMaterial": { + "title": "Reward Type Material", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MATERIAL" + ] + }, + "parameters": { + "type": "object", + "required": [ + "product" + ], + "properties": { + "product": { + "type": "object", + "required": [ + "id", + "sku" + ], + "properties": { + "id": { + "type": "string" + }, + "sku": { + "type": [ + "string", + "null" + ] + } + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeCampaign": { + "title": "Reward Type Campaign", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CAMPAIGN" + ] + }, + "parameters": { + "type": "object", + "required": [ + "campaign" + ], + "properties": { + "campaign": { + "type": "object", + "required": [ + "id", + "type" + ], + "properties": { + "id": { + "type": "string" + }, + "balance": { + "type": "integer" + }, + "type": { + "type": "string", + "enum": [ + "DISCOUNT_COUPONS", + "PROMOTION", + "GIFT_VOUCHERS", + "REFERRAL_PROGRAM" + ] + } + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardType": { + "title": "Reward Type", + "anyOf": [ + { + "$ref": "#/components/schemas/RewardTypeCampaign" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + } + ] + }, + "LoyaltiesAddOrRemoveCardBalanceResponseBody": { + "title": "Loyalties Add Or Remove Card Balance Response Body", + "type": "object", + "description": "Response schema for adding or removing points from a loyalty card.", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "minimum": 0, + "description": "The balance after adding/removing points." + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ], + "description": "The type of voucher being modified." + }, + "object": { + "type": "string", + "pattern": "balance", + "enum": [ + "balance" + ], + "description": "The type of object represented by JSON. Default is balance." + }, + "related_object": { + "type": "object", + "required": [ + "type", + "id" + ], + "description": "Defines the object that is being modified with the values that are returned in the balance object.", + "properties": { + "type": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The object being modified." + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." + } + } + }, + "operation_type": { + "type": "string", + "enum": [ + "MANUAL", + "AUTOMATIC" + ] + } + }, + "required": [ + "points", + "total", + "balance", + "type", + "object", + "related_object" + ] + }, + "LoyaltiesTransferPointsResponseBody": { + "title": "Loyalties Transfer Points Response Body", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": [ + "string", + "null" + ], + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Unique category ID assigned by Voucherify." + }, + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Category" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", + "required": [ + "points", + "balance" + ], + "properties": { + "points": { + "type": "integer", + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": [ + "string", + "null" + ], + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", + "format": "date-time" + }, + "expiration_date": { + "type": [ + "string", + "null" + ], + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", + "format": "date-time" + }, + "validity_timeframe": { + "type": [ + "object", + "null" + ], + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." + }, + "duration": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": [ + "array", + "null" + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "count": { + "type": "integer", + "description": "Publication events counter." + }, + "entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string", + "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" + } + }, + "required": [ + "object" + ] + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "How many times a voucher can be redeemed. A null value means unlimited." + }, + "redeemed_points": { + "type": "integer", + "description": "Total loyalty points redeemed." + }, + "redeemed_quantity": { + "type": "integer", + "description": "How many times a voucher has already been redeemed." + }, + "redemption_entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" + } + }, + "required": [ + "quantity" + ] + }, + "active": { + "type": "string", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" + }, + "additional_info": { + "type": [ + "string", + "null" + ], + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of voucher owner." + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "id", + "code", + "category", + "category_id", + "type", + "loyalty_card", + "start_date", + "expiration_date", + "validity_timeframe", + "validity_day_of_week", + "active", + "additional_info", + "metadata", + "is_referral_code", + "created_at" + ] + }, + "LoyaltiesTransferPoints": { + "title": "Loyalties Transfer Points", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source)." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + }, + "required": [ + "code", + "points", + "source_id" + ] + }, + "LoyaltiesTransferPointsRequestBody": { + "title": "Loyalties Transfer Points Request Body", + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltiesTransferPoints" + } + }, + "LoyaltiesAddOrRemoveCardBalanceRequestBody": { + "title": "Loyalties Add Or Remove Card Balance Request Body", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" + }, + "expiration_type": { + "$ref": "#/components/schemas/PointsExpirationTypes", + "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + }, + "required": [ + "points" + ] + }, + "PointsExpirationTypes": { + "title": "Points Expiration Types", + "type": "string", + "enum": [ + "PROGRAM_RULES", + "CUSTOM_DATE", + "NON_EXPIRING" + ] + }, + "Category": { + "title": "Category", + "x-stoplight": { + "id": "4l87q60w8ta36" + }, + "type": "object", + "description": "This is an object representing a category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "enum": [ + "category" + ], + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object" + ] + }, + "ExportsCreateRequestBody": { + "anyOf": [ + { + "title": "Export Vouchers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Redemptions", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "redemption" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportRedemptionOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportRedemptionFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Customers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "customer" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Publications", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPublicationFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Order", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportOrderFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Points Expirations", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Vouchers Transactions Expiration", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + } + ], + "type": "object" + }, + "ExportBase": { + "title": "ExportBase", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ], + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": [ + "object", + "null" + ], + "required": [ + "url" + ], + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the token used for authorization in the Download export method." + } + } + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] + }, + "Export": { + "title": "Export", + "allOf": [ + { + "$ref": "#/components/schemas/ExportBase" + }, + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" + }, + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + } + ] + } + ] + }, + "ExportsCreateResponseBody": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] + }, + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" + }, + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + } + ] + } + ], + "title": "" + }, + "ExportVoucher": { + "title": "Export Vouchers", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." + } + } + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "FieldConditions": { + "title": "Field Conditions", "type": "object", "properties": { - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ], - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + "conditions": { + "$ref": "#/components/schemas/FiltersCondition", + "description": "Data filters used to narrow the data records to be returned in the result." + } + } + }, + "FiltersCondition": { + "title": "Filters Condition", + "type": "object", + "properties": { + "$in": { + "$ref": "#/components/schemas/Any" }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" - } + "$not_in": { + "$ref": "#/components/schemas/Any" + }, + "$is": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_ago": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_in_future": { + "$ref": "#/components/schemas/Any" + }, + "$is_not": { + "$ref": "#/components/schemas/Any" + }, + "$has_value": { + "$ref": "#/components/schemas/Any" + }, + "$is_unknown": { + "$ref": "#/components/schemas/Any" + }, + "$contains": { + "$ref": "#/components/schemas/Any" + }, + "$not_contain": { + "$ref": "#/components/schemas/Any" + }, + "$starts_with": { + "$ref": "#/components/schemas/Any" + }, + "$ends_with": { + "$ref": "#/components/schemas/Any" + }, + "$more_than": { + "$ref": "#/components/schemas/Any" + }, + "$less_than": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$after": { + "$ref": "#/components/schemas/Any" + }, + "$before": { + "$ref": "#/components/schemas/Any" + }, + "$count": { + "$ref": "#/components/schemas/Any" + }, + "$count_less": { + "$ref": "#/components/schemas/Any" + }, + "$count_more": { + "$ref": "#/components/schemas/Any" } } }, - "LoyaltiesExportCardTransactionsResponseBody": { - "title": "Loyalties Export Card Transactions Response Body", + "ExportVoucherFilters": { + "title": "Export Voucher Filters", "type": "object", - "description": "", "properties": { + "junction": { + "$ref": "#/components/schemas/Junction", + "description": "Filter by conditions set on the junction parameter indicating how the conditions should be accounted for in the query. An AND is an all-inclusive logical operator, meaning the AND operator displays a record if ALL the conditions separated by AND are TRUE, while an OR operator displays a record if ANY of the conditions separated by OR is TRUE." + }, + "code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "value": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "category": { + "$ref": "#/components/schemas/FieldConditions" + }, + "start_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "expiration_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_quantity": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "active": { + "$ref": "#/components/schemas/FieldConditions" + }, + "qr_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "bar_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, "id": { - "type": "string", - "description": "Unique export ID." + "$ref": "#/components/schemas/FieldConditions" }, - "object": { - "type": "string", - "pattern": "export", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." + "is_referral_code": { + "$ref": "#/components/schemas/FieldConditions" }, "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" + "$ref": "#/components/schemas/FieldConditions" }, - "status": { - "type": "string", - "pattern": "SCHEDULED", - "enum": [ - "SCHEDULED" - ], - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." + "validity_timeframe_interval": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_timeframe_duration": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_day_of_week": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount_limit": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "additional_info": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" }, + "discount_unit_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_unit_effect": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "Junction": { + "title": "Junction", + "enum": [ + "and", + "AND", + "or", + "OR" + ], + "type": "string" + }, + "ExportRedemption": { + "title": "Export Redemptions", + "type": "object", + "properties": { "exported_object": { "type": "string", - "pattern": "voucher_transactions", "enum": [ - "voucher_transactions" + "redemption" ], - "description": "The type of exported object." + "description": "The type of object to be exported." }, "parameters": { "type": "object", - "required": [ - "filters" - ], - "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", "properties": { "order": { - "type": "string", + "$ref": "#/components/schemas/ExportRedemptionOrder", "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, "fields": { "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + "$ref": "#/components/schemas/ExportRedemptionFields" } }, "filters": { - "type": "object", - "required": [ - "voucher_id" - ], - "description": "Filter condition.", - "properties": { - "voucher_id": { - "type": "object", - "required": [ - "conditions" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "required": [ - "$in" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "string", - "minLength": 1, - "maxLength": 1 - } - } - } - } - } - } - } + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." } - } - }, - "result": { - "type": "null", - "description": "Contains the URL of the CSV file." - }, - "user_id": { - "type": [ - "string", - "null" - ], - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, "required": [ - "id", - "object", - "created_at", - "status", - "channel", "exported_object", - "parameters", - "result", - "user_id" + "parameters" ] }, - "LoyaltiesAddOrRemoveCardBalanceResponseBody": { - "title": "Loyalties Add Or Remove Card Balance Response Body", + "ExportRedemptionFilters": { + "title": "Export Redemption Filters", "type": "object", - "description": "Response schema for adding or removing points from a loyalty card.", + "additionalProperties": false, "properties": { - "points": { - "type": "integer", - "description": "The incremental points removed or added to the current balance on the loyalty card." + "junction": { + "$ref": "#/components/schemas/Junction" }, - "total": { - "type": "integer", - "description": "The total of points accrued over the lifetime of the loyalty card." + "id": { + "$ref": "#/components/schemas/FieldConditions" }, - "balance": { - "type": "integer", - "minimum": 0, - "description": "The balance after adding/removing points." + "object": { + "$ref": "#/components/schemas/FieldConditions" }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "The type of voucher being modified." + "date": { + "$ref": "#/components/schemas/FieldConditions" }, - "object": { + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "promotion_tier_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "tracking_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "result": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_message": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportCustomer": { + "title": "Export Customers", + "type": "object", + "properties": { + "exported_object": { "type": "string", - "pattern": "balance", "enum": [ - "balance" + "customer" ], - "description": "The type of object represented by JSON. Default is balance." + "description": "The type of object to be exported." }, - "related_object": { + "parameters": { "type": "object", - "required": [ - "type", - "id" - ], - "description": "Defines the object that is being modified with the values that are returned in the balance object.", "properties": { - "type": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The object being modified." + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "id": { - "type": "string", - "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." } - } - }, - "operation_type": { - "type": "string", - "enum": [ - "MANUAL", - "AUTOMATIC" - ] + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, "required": [ - "points", - "total", - "balance", - "type", - "object", - "related_object" + "exported_object", + "parameters" ] }, - "LoyaltiesTransferPointsResponseBody": { - "title": "Loyalties Transfer Points Response Body", + "ExportCustomerFilters": { + "title": "Export Customer Filters", "type": "object", "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, "id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher." + "$ref": "#/components/schemas/FieldConditions" }, - "code": { - "type": "string", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + "description": { + "$ref": "#/components/schemas/FieldConditions" }, - "campaign": { - "type": "string", - "description": "A unique campaign name, identifies the voucher's parent campaign." + "email": { + "$ref": "#/components/schemas/FieldConditions" }, - "campaign_id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + "source_id": { + "$ref": "#/components/schemas/FieldConditions" }, - "category": { - "type": [ - "string", - "null" - ], - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + "created_at": { + "$ref": "#/components/schemas/FieldConditions" }, - "category_id": { - "type": [ - "string", - "null" - ], - "description": "Unique category ID assigned by Voucherify." + "address_city": { + "$ref": "#/components/schemas/FieldConditions" }, - "categories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Category" - } + "address_state": { + "$ref": "#/components/schemas/FieldConditions" }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher." + "address_line_1": { + "$ref": "#/components/schemas/FieldConditions" }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", - "required": [ - "points", - "balance" - ], - "properties": { - "points": { - "type": "integer", - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } + "address_line_2": { + "$ref": "#/components/schemas/FieldConditions" }, - "start_date": { - "type": [ - "string", - "null" - ], - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", - "format": "date-time" + "address_country": { + "$ref": "#/components/schemas/FieldConditions" }, - "expiration_date": { - "type": [ - "string", - "null" - ], - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", - "format": "date-time" + "address_postal_code": { + "$ref": "#/components/schemas/FieldConditions" }, - "validity_timeframe": { - "type": [ - "object", - "null" - ], - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." - }, - "duration": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." - } - } + "redemptions_total_redeemed": { + "$ref": "#/components/schemas/FieldConditions" }, - "validity_day_of_week": { - "type": [ - "array", - "null" + "redemptions_total_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rolled_back": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_average_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_referred_customers": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "phone": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthday": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthdate": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportPublication": { + "title": "Export Publications", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 - } + "description": "The type of object to be exported." }, - "publish": { + "parameters": { "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "count": { - "type": "integer", - "description": "Publication events counter." + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "entries": { + "fields": { "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", "items": { - "type": "string" + "$ref": "#/components/schemas/ExportPublicationFields" } }, - "url": { - "type": "string", - "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." } }, - "required": [ - "object" - ] + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportPublicationFilters": { + "title": "Export Publication Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "How many times a voucher can be redeemed. A null value means unlimited." - }, - "redeemed_points": { - "type": "integer", - "description": "Total loyalty points redeemed." - }, - "redeemed_quantity": { - "type": "integer", - "description": "How many times a voucher has already been redeemed." + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "channel": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "is_winner": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportOrder": { + "title": "Export Orders", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "redemption_entries": { + "fields": { "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", "items": { - "type": "string" + "$ref": "#/components/schemas/ExportOrderFields" } }, - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." } }, - "required": [ - "quantity" - ] + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportOrderFilters": { + "title": "Export Order Filters", + "type": "object", + "additionalProperties": false, + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" }, - "active": { - "type": "string", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" + "id": { + "$ref": "#/components/schemas/FieldConditions" }, - "additional_info": { - "type": [ - "string", - "null" - ], - "description": "An optional field to keep any extra textual information about the code such as a code description and details." + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "status": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "items_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "referrer_id": { + "$ref": "#/components/schemas/FieldConditions" }, "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportPointsExpiration": { + "title": "Export Points Expirations", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" + ], + "description": "The type of object to be exported." }, - "assets": { + "parameters": { "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`" - } - } + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "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`" - } + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" } + }, + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "holder_id": { - "type": "string", - "description": "Unique customer ID of voucher owner." - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, "required": [ - "id", - "code", - "category", - "category_id", - "type", - "loyalty_card", - "start_date", - "expiration_date", - "validity_timeframe", - "validity_day_of_week", - "active", - "additional_info", - "metadata", - "is_referral_code", - "created_at" + "exported_object", + "parameters" ] }, - "LoyaltiesTransferPoints": { - "title": "Loyalties Transfer Points", + "ExportPointsExpirationFilters": { + "title": "Export Points Expiration Filters", "type": "object", "properties": { - "code": { - "type": "string", - "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" }, "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)." + "$ref": "#/components/schemas/FieldConditions" }, - "reason": { - "type": "string", - "description": "Reason for the transfer." + "status": { + "$ref": "#/components/schemas/FieldConditions" }, - "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." + "expires_at": { + "$ref": "#/components/schemas/FieldConditions" } - }, - "required": [ - "code", - "points", - "source_id" - ] - }, - "LoyaltiesTransferPointsRequestBody": { - "title": "Loyalties Transfer Points Request Body", - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltiesTransferPoints" } }, - "LoyaltiesAddOrRemoveCardBalanceRequestBody": { - "title": "Loyalties Add Or Remove Card Balance Request Body", + "ExportVoucherTransactionsExpiration": { + "title": "Export Vouchers Transactions Expiration", "type": "object", "properties": { - "points": { - "type": "integer", - "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" - }, - "expiration_type": { - "$ref": "#/components/schemas/PointsExpirationTypes", - "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." - }, - "reason": { + "exported_object": { "type": "string", - "description": "Reason for the transfer." + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." }, - "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." + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, "required": [ - "points" - ] - }, - "PointsExpirationTypes": { - "title": "Points Expiration Types", - "type": "string", - "enum": [ - "PROGRAM_RULES", - "CUSTOM_DATE", - "NON_EXPIRING" + "exported_object", + "parameters" ] }, - "Category": { - "title": "Category", - "x-stoplight": { - "id": "4l87q60w8ta36" - }, + "ExportVoucherTransactionsFilters": { + "title": "Export Voucher Transactions Filters", "type": "object", - "description": "This is an object representing a category.", "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." + "$ref": "#/components/schemas/FieldConditions" }, - "name": { - "type": "string", - "description": "Category name." + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "reason": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source": { + "$ref": "#/components/schemas/FieldConditions" + }, + "balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "related_transaction_id": { + "$ref": "#/components/schemas/FieldConditions" }, "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." + "$ref": "#/components/schemas/FieldConditions" }, - "updated_at": { + "details": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportsGetResponseBody": { + "$ref": "#/components/schemas/Export", + "title": "" + }, + "ExportsListResponseBody": { + "title": "Exports List Response Body", + "type": "object", + "properties": { + "object": { "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about exports." }, - "object": { + "data_ref": { "type": "string", "enum": [ - "category" + "exports" ], - "description": "The type of object represented by the JSON. This object stores information about the category." + "description": "Identifies the name of the attribute that contains the array of exports." + }, + "exports": { + "type": "array", + "description": "An array of export objects.", + "items": { + "$ref": "#/components/schemas/Export" + } + }, + "total": { + "type": "integer", + "description": "Total number of exports." } }, "required": [ + "object", + "data_ref", + "exports", + "total" + ] + }, + "ExportCustomerFields": { + "type": "string", + "enum": [ + "name", "id", + "description", + "email", + "source_id", + "created_at", + "address_city", + "address_state", + "address_line_1", + "address_line_2", + "address_country", + "address_postal_code", + "redemptions_total_redeemed", + "redemptions_total_failed", + "redemptions_total_succeeded", + "redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "orders_total_amount", + "orders_total_count", + "orders_average_amount", + "orders_last_order_amount", + "orders_last_order_date", + "loyalty_points", + "loyalty_referred_customers", + "updated_at", + "phone", + "birthday", + "metadata", + "birthdate" + ], + "title": "Export Customer Fields" + }, + "ExportCustomerOrder": { + "title": "Export Customer Order", + "type": "string", + "enum": [ "name", - "hierarchy", + "-name", + "id", + "-id", + "description", + "-description", + "email", + "-email", + "source_id", + "-source_id", "created_at", - "object" + "-created_at", + "address_city", + "-address_city", + "address_state", + "-address_state", + "address_line_1", + "-address_line_1", + "address_line_2", + "-address_line_2", + "address_country", + "-address_country", + "address_postal_code", + "-address_postal_code", + "redemptions_total_redeemed", + "-redemptions_total_redeemed", + "redemptions_total_failed", + "-redemptions_total_failed", + "redemptions_total_succeeded", + "-redemptions_total_succeeded", + "redemptions_total_rolled_back", + "-redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "-redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "-redemptions_total_rollback_succeeded", + "orders_total_amount", + "-orders_total_amount", + "orders_total_count", + "-orders_total_count", + "orders_average_amount", + "-orders_average_amount", + "orders_last_order_amount", + "-orders_last_order_amount", + "orders_last_order_date", + "-orders_last_order_date", + "loyalty_points", + "-loyalty_points", + "loyalty_referred_customers", + "-loyalty_referred_customers", + "updated_at", + "-updated_at", + "phone", + "-phone", + "birthday", + "-birthday", + "metadata", + "-metadata", + "birthdate", + "-birthdate" + ] + }, + "ExportPublicationFields": { + "title": "Export Publication Fields", + "type": "string", + "enum": [ + "voucher_code", + "customer_id", + "customer_source_id", + "date", + "channel", + "campaign", + "is_winner", + "metadata" + ] + }, + "ExportPublicationOrder": { + "title": "Export Publication Order", + "type": "string", + "enum": [ + "voucher_code", + "-voucher_code", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "date", + "-date", + "channel", + "-channel", + "campaign", + "-campaign", + "is_winner", + "-is_winner", + "metadata", + "-metadata" + ] + }, + "ExportRedemptionFields": { + "title": "Export Redemption Fields", + "type": "string", + "enum": [ + "id", + "object", + "date", + "voucher_code", + "campaign", + "promotion_tier_id", + "customer_id", + "customer_source_id", + "customer_name", + "tracking_id", + "order_amount", + "gift_amount", + "loyalty_points", + "result", + "failure_code", + "failure_message", + "metadata" + ] + }, + "ExportRedemptionOrder": { + "title": "Export Redemption Order", + "type": "string", + "enum": [ + "id", + "-id", + "object", + "-object", + "date", + "-date", + "voucher_code", + "-voucher_code", + "campaign", + "-campaign", + "promotion_tier_id", + "-promotion_tier_id", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "customer_name", + "-customer_name", + "tracking_id", + "-tracking_id", + "order_amount", + "-order_amount", + "gift_amount", + "-gift_amount", + "loyalty_points", + "-loyalty_points", + "result", + "-result", + "failure_code", + "-failure_code", + "failure_message", + "-failure_message", + "metadata", + "-metadata" + ] + }, + "ExportVoucherFields": { + "title": "Export Voucher Fields", + "type": "string", + "enum": [ + "code", + "voucher_type", + "value", + "discount_type", + "campaign", + "category", + "start_date", + "expiration_date", + "gift_balance", + "loyalty_balance", + "redemption_quantity", + "redemption_count", + "active", + "qr_code", + "bar_code", + "metadata", + "id", + "is_referral_code", + "created_at", + "updated_at", + "validity_timeframe_interval", + "validity_timeframe_duration", + "validity_day_of_week", + "discount_amount_limit", + "campaign_id", + "additional_info", + "customer_id", + "discount_unit_type", + "discount_unit_effect", + "customer_source_id" + ] + }, + "ExportVoucherOrder": { + "title": "Export Voucher Order", + "type": "string", + "enum": [ + "code", + "-code", + "voucher_type", + "-voucher_type", + "value", + "-value", + "discount_type", + "-discount_type", + "campaign", + "-campaign", + "category", + "-category", + "start_date", + "-start_date", + "expiration_date", + "-expiration_date", + "gift_balance", + "-gift_balance", + "loyalty_balance", + "-loyalty_balance", + "redemption_quantity", + "-redemption_quantity", + "redemption_count", + "-redemption_count", + "active", + "-active", + "qr_code", + "-qr_code", + "bar_code", + "-bar_code", + "metadata", + "-metadata", + "id", + "-id", + "is_referral_code", + "-is_referral_code", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "validity_timeframe_interval", + "-validity_timeframe_interval", + "validity_timeframe_duration", + "-validity_timeframe_duration", + "validity_day_of_week", + "-validity_day_of_week", + "discount_amount_limit", + "-discount_amount_limit", + "campaign_id", + "-campaign_id", + "additional_info", + "-additional_info", + "customer_id", + "-customer_id", + "discount_unit_type", + "-discount_unit_type", + "discount_unit_effect", + "-discount_unit_effect", + "customer_source_id", + "-customer_source_id" + ] + }, + "ExportOrderFields": { + "title": "Export Order Fields", + "type": "string", + "enum": [ + "id", + "source_id", + "created_at", + "updated_at", + "status", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata" + ] + }, + "ExportOrderOrder": { + "title": "Export Order Order", + "type": "string", + "enum": [ + "id", + "-id", + "source_id", + "-source_id", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "status", + "-status", + "amount", + "-amount", + "discount_amount", + "-discount_amount", + "items_discount_amount", + "-items_discount_amount", + "total_discount_amount", + "-total_discount_amount", + "total_amount", + "-total_amount", + "customer_id", + "-customer_id", + "referrer_id", + "-referrer_id", + "metadata", + "-metadata" + ] + }, + "ExportPointsExpirationFields": { + "title": "Export Points Expiration Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "points", + "status", + "expires_at" + ] + }, + "ExportPointsExpirationOrder": { + "title": "Export Points Expiration Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "points", + "-points", + "status", + "-status", + "expires_at", + "-expires_at" + ] + }, + "ExportVoucherTransactionsFields": { + "title": "Export Voucher Transactions Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "ExportVoucherTransactionsOrder": { + "title": "Export Voucher Transactions Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "type", + "-type", + "source_id", + "-source_id", + "reason", + "-reason", + "source", + "-source", + "balance", + "-balance", + "amount", + "-amount", + "related_transaction_id", + "-related_transaction_id", + "created_at", + "-created_at", + "details", + "-details" ] }, + "Any": { + "anyOf": [ + { + "title": "array", + "type": "array", + "items": { + "anyOf": [ + { + "title": "string", + "type": "string" + }, + { + "title": "number", + "type": "number" + }, + { + "title": "object", + "type": "object" + } + ] + } + }, + { + "title": "string", + "type": "string" + }, + { + "title": "number", + "type": "number" + }, + { + "title": "object", + "type": "object" + } + ], + "title": "Any" + }, "a_req_importCSV": { "type": "object", "title": "Import CSV file", @@ -65727,7 +68167,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" + "$ref": "#/components/schemas/8_req_add_remove_points_balance" }, "examples": { "Add points": { @@ -65752,7 +68192,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, "examples": { "Add balance": { @@ -65841,7 +68281,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceRequestBody" + "$ref": "#/components/schemas/8_req_add_remove_points_balance" }, "examples": { "Subtract points": { @@ -65866,7 +68306,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesAddOrRemoveCardBalanceResponseBody" + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, "examples": { "Subtract Points": { @@ -65950,7 +68390,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesTransferPointsRequestBody" + "$ref": "#/components/schemas/8_req_transfer_loyalty_points" }, "examples": { "Example": { @@ -65975,7 +68415,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesTransferPointsResponseBody" + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" }, "examples": { "Example": { @@ -66087,7 +68527,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" }, "examples": { "Example": { @@ -66428,7 +68868,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" }, "examples": { "Example": { @@ -66761,7 +69201,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" }, "examples": { "Example": { @@ -66794,7 +69234,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_obj_export_transactions_object" }, "examples": { "Example": { @@ -66927,7 +69367,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsRequestBody" + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" }, "examples": { "Example": { @@ -66960,7 +69400,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesExportCardTransactionsResponseBody" + "$ref": "#/components/schemas/8_obj_export_transactions_object" }, "examples": { "Example": { @@ -67102,7 +69542,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetPointsExpirationResponseBody" + "$ref": "#/components/schemas/8_res_get_points_expiration" }, "examples": { "Example": { @@ -70075,7 +72515,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" + "$ref": "#/components/schemas/4_obj_reward_object" }, "examples": { "Material": { @@ -70608,7 +73048,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" + "$ref": "#/components/schemas/4_obj_reward_assignment_object" }, "examples": { "Example": { @@ -72692,7 +75132,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" + "$ref": "#/components/schemas/8_res_list_loyalty_tiers" }, "examples": { "Example": { @@ -72815,43 +75255,6 @@ } } } - }, - "post": { - "operationId": "create-loyalty-tiers", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create loyalty tiers", - "description": "Creates loyalty tiers for desired campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns created loyalty tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" - } - } - } - } - }, - "requestBody": { - "description": "Provide tier definitions you want to add to existing loyalty campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" - } - } - } - } } }, "/v1/loyalties/{campaignId}/tiers/{tierId}": { @@ -72897,7 +75300,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetTierResponseBody" + "$ref": "#/components/schemas/8_obj_loyalty_tier_object" }, "examples": { "Example": { @@ -72987,7 +75390,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" + "$ref": "#/components/schemas/8_res_get_member_loyalty_tier" }, "examples": { "Example": { @@ -73110,7 +75513,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesRequestQuery" + "$ref": "#/components/schemas/8_res_list_loyalty_tier_earning_rules" }, "examples": { "example-1": { diff --git a/scripts/md-tables.ts b/scripts/md-tables.ts index 874e0c236..f70db227a 100644 --- a/scripts/md-tables.ts +++ b/scripts/md-tables.ts @@ -7,11 +7,11 @@ export const mdTables: [string, string?][] = [ ['5_obj_publication_object', 'PUBLICATIONS-API-Publication-Object.md'], ['6_res_validate_voucher', 'VALIDATIONS-API-Validation-Object.md'], ['7_obj_redemption_object', 'REDEMPTIONS-API-Redemption-Object.md'], - ['7_obj_rollback_redemption_object_extended', 'REDEMPTIONS-API-Rollback-Redemption-Object.md'], + ['7_obj_rollback_redemption_object_extended', 'REDEMPTIONS-API-Rollback-Redemption-Object.md'], ['19_res_redemptions_POST', 'STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md'], ['8_obj_loyalty_campaign_object', 'LOYALTIES-API-Loyalty-Campaign-Object.md'], ['8_obj_loyalty_card_object_non_expanded_categories', 'LOYALTIES-API-Loyalty-Card-Object.md'], - ['8_obj_earning_rule_object', 'LOYALTIES-API-Earning-Rule-Object.md'], + ['8_obj_earning_rule_object', 'LOYALTIES-API-Earning-Rule-Object.md'], ['8_obj_loyalty_tier_object', 'LOYALTIES-API-Loyalty-Tier-Object.md'], ['9_obj_customer_object', 'CUSTOMERS-API-Customer-Object.md'], ['9_obj_customer_activity_object', 'CUSTOMERS-API-Customer-Activity-Object.md'], @@ -25,9 +25,9 @@ export const mdTables: [string, string?][] = [ ['15_req_track_custom_event', 'EVENTS-API-Custom-Event-Object.md'], ['18_res_list_consents_GET', 'CONSENTS-API-Consents-Object.md'], ['17_obj_async_action_object', 'ASYNC-ACTIONS-API-Async-Action-Object.md'], - ['16_obj_export_object', 'EXPORTS-API-Export-Object.md'], + ['Export', 'EXPORTS-API-Export-Object.md'], ['20_obj_category_object', 'CATEGORIES-API-Category-Object.md'], ['21_obj_metadata_schema_object', 'METADATA-SCHEMAS-API-Metadata-Schema-Object.md'], ['22_obj_location_object', 'LOCATIONS-API-Location-Object.md'], ['23_obj_qualification_object', 'QUALIFICATIONS-API-Qualification-Object.md'] -]; \ No newline at end of file +]; diff --git a/scripts/src/schema-to-md-table.ts b/scripts/src/schema-to-md-table.ts index 71f05dfd1..69c2bf889 100644 --- a/scripts/src/schema-to-md-table.ts +++ b/scripts/src/schema-to-md-table.ts @@ -17,7 +17,7 @@ yup.addMethod( const nodeWithTitleAndPropertiesSchema = yup.object({ title: yup.string().optional(), - type: yup.string().oneOf(["object", "string", "array"]), + type: yup.string().oneOf(["object", "string", "array", "number"]), properties: yup.object({}), anyOf: yup.array().optional(), }); @@ -51,6 +51,8 @@ const anyOfSchema = yup ) .optional(); +const allOfSchema = anyOfSchema; + const propertySchema = yup.object({ type: yup.mixed().oneOfSchemas([yup.string(), yup.array().of(yup.string())]), properties: yup.object({}), @@ -69,12 +71,14 @@ const propertySchema = yup.object({ .optional(), oneOf: oneOfSchema, anyOf: anyOfSchema, + allOf: allOfSchema, items: itemsSchema, $ref: yup.string().optional(), }); interface Items extends yup.InferType {} interface AnyOf extends yup.InferType {} +interface AllOf extends yup.InferType {} interface OneOf extends yup.InferType {} export type Properties = Record; @@ -162,10 +166,16 @@ export default class SchemaToMarkdownTable { return { descriptionArr, relatedObjectsNames }; } - private renderAnyOfDescription(anyOf: AnyOf, level: number) { + private renderAnyOfDescription( + anyOf: AnyOf, + level: number, + skipAnyOf: boolean = false + ) { const descriptionArr = []; const relatedObjectsNames = []; - descriptionArr.push(`Any of:`); + if (!skipAnyOf) { + descriptionArr.push(`Any of:`); + } const nestedObjectsHtml = anyOf .map((item) => { if ( @@ -193,11 +203,117 @@ export default class SchemaToMarkdownTable { const { html, relatedObjects } = this.renderSchema(item, level + 1); relatedObjectsNames.push(...relatedObjects); return renderMarkdown(html); + } else if ("items" in item) { + const { html, relatedObjects } = this.renderSchema( + item, + level + 1, + true + ); + relatedObjectsNames.push(...relatedObjects); + return renderMarkdown(html); + } else if ( + "type" in item && + typeof item.type === "string" && + ["string", "number", "object"].includes(item.type) + ) { + return level ? item.type : renderMarkdown(item.type); + } + }) + .filter((i) => !!i); + descriptionArr.push(this.smartJoin(nestedObjectsHtml)); + return { descriptionArr, relatedObjectsNames }; + } + + private smartJoin(items: string[]): string { + const removeAllHtmlNesting = (html) => { + let letHtml = `${html}`; + let indexOfFirstMinoritySign = letHtml.indexOf("<"); + let indexOfFirstMajoritySign = letHtml.indexOf(">"); + while (indexOfFirstMinoritySign >= 0 && indexOfFirstMajoritySign >= 0) { + letHtml = `${letHtml.slice(0, indexOfFirstMinoritySign)}${letHtml.slice( + indexOfFirstMajoritySign + 1, + letHtml.length + )}`; + indexOfFirstMinoritySign = letHtml.indexOf("<"); + indexOfFirstMajoritySign = letHtml.indexOf(">"); + } + return letHtml; + }; + + if ( + items.filter((item) => item.at(0) === "<" && item.at(-1) === ">") + .length === items.length && + !items.find( + (item) => item.includes("") && item.includes("
") + ) + ) { + //all items are http tag, no table tag found + return items + .map((item, index) => { + return ` ${index + 1}. ${removeAllHtmlNesting(item)}`; + }) + .join("\n"); + } + //regular join + return items + .map((item, index) => { + if (!index) { + return item; + } + if (items[index - 1].at(0) === "<" && items[index - 1].at(-1) === ">") { + return item; + } + return `${this.redenderMode === RenderMode.List ? ", " : ""}${item}`; + }) + .join(""); + } + + private renderAllOfDescription(allOf: AnyOf, level: number) { + const descriptionArr = []; + const relatedObjectsNames = []; + descriptionArr.push(`All of:`); + const nestedObjectsHtml = allOf + .map((item) => { + if ( + "$ref" in item && + typeof item["$ref"] === "string" && + item["$ref"].startsWith("#/components/schemas/") + ) { + const nestedObjectName = item["$ref"].replace( + "#/components/schemas/", + "" + ); + if (typeof this.schemas[nestedObjectName] !== "object") { + return false; + } + relatedObjectsNames.push(nestedObjectName); + const title = (this.schemas[nestedObjectName].title || + nestedObjectName) as string; + if (this.redenderMode === RenderMode.List) { + return this.getMarkdownLinkToHeader(title); + } else { + const { html } = this.renderSchema(nestedObjectName, level + 1); + return renderMarkdown(html); + } + } else if ("properties" in item) { + const { html, relatedObjects } = this.renderSchema(item, level + 1); + relatedObjectsNames.push(...relatedObjects); + return renderMarkdown(html); + } else if ("anyOf" in item) { + const anyOf = anyOfSchema.validateSync(item["anyOf"]); + const { + descriptionArr: anyOfDescriptionArr, + relatedObjectsNames: anyOfRelatedObjectsNames, + } = this.renderAnyOfDescription(anyOf, level + 1); + relatedObjectsNames.push(...anyOfRelatedObjectsNames); + return anyOfDescriptionArr.join(" "); } }) .filter((i) => !!i); descriptionArr.push( - nestedObjectsHtml.join(this.redenderMode === RenderMode.List ? ", " : "") + nestedObjectsHtml + .map((row, index) => `${index + 1}. ${row}`) + .join(this.redenderMode === RenderMode.List ? `${EOL}` : "") ); return { descriptionArr, relatedObjectsNames }; } @@ -230,6 +346,14 @@ export default class SchemaToMarkdownTable { const { html, relatedObjects } = this.renderSchema(items, level + 1); relatedObjectsNames.push(...relatedObjects); descriptionArr.push(renderMarkdown(html)); + } else if ("anyOf" in items) { + const anyOf = anyOfSchema.validateSync(items.anyOf); + const { + descriptionArr: anyOfDescriptionArr, + relatedObjectsNames: anyOfRelatedObjectsNames, + } = this.renderAnyOfDescription(anyOf, level + 1, true); + relatedObjectsNames.push(...anyOfRelatedObjectsNames); + descriptionArr.push(`Array any of: ${anyOfDescriptionArr.join(" ")}`); } return { descriptionArr, relatedObjectsNames }; } @@ -263,6 +387,7 @@ export default class SchemaToMarkdownTable { enum: EnumProp, oneOf, anyOf, + allOf, items, type, $ref, @@ -289,6 +414,15 @@ export default class SchemaToMarkdownTable { relatedObjectsNames.push(...relatedObjectsNamesOneOff); } + if (allOf) { + const { + descriptionArr: descriptionArrAllOf, + relatedObjectsNames: relatedObjectsNamesAllOff, + } = this.renderAllOfDescription(allOf, level); + descriptionArr.push(...descriptionArrAllOf); + relatedObjectsNames.push(...relatedObjectsNamesAllOff); + } + if (anyOf) { const { descriptionArr: descriptionArrAnyOf, @@ -375,7 +509,8 @@ export default class SchemaToMarkdownTable { private renderSchema( schemaNameOrSchemaObject: string | object, - level: number = 0 + level: number = 0, + skipTitle: boolean = false ) { const schema = typeof schemaNameOrSchemaObject === "object" @@ -388,9 +523,9 @@ export default class SchemaToMarkdownTable { nodeWithTitleAndPropertiesSchema.validateSync(schema); const respopnseStrArr = []; - if (title) { + if (!skipTitle && title) { respopnseStrArr.push(`${"#".repeat(level + 2)} ${title}`); - } else { + } else if (!skipTitle) { if (typeof schemaNameOrSchemaObject === "string") { throw new Error(`Missing title for ${schemaNameOrSchemaObject} object`); }