Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
223 changes: 113 additions & 110 deletions ENDPOINTS-COVERAGE.md

Large diffs are not rendered by default.

62 changes: 41 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ Get your Voucherify keys for valid authorization and setting the basePath (clust
- Asia (Singapore): `https://as1.api.voucherify.io`
3. Scroll down to **Application Keys** to grab your Application ID and Secret key.


## 🚀 Run code

Once installed, run:

```python
import os
import voucherify
from dotenv import load_dotenv

load_dotenv()

HOST = os.getenv('VOUCHERIFY_HOST', 'https://api.voucherify.io')
X_APP_ID = os.getenv('X_APP_ID')
Expand All @@ -84,26 +80,21 @@ configuration = voucherify.Configuration(
"X-App-Token": X_APP_TOKEN
}
)
# Debugging line
api_key_id = configuration.get_api_key_with_prefix('X-App-Id')
api_key_token = configuration.get_api_key_with_prefix('X-App-Token')

# Print whether both API keys are present and valid
are_keys_present = bool(api_key_id) and bool(api_key_token)
print(f"Configuration loaded: {are_keys_present}")

if(are_keys_present):
with voucherify.ApiClient(configuration) as api_client:
customers_api_instance = voucherify.CustomersApi(api_client)
with voucherify.ApiClient(configuration) as api_client:
campaigns_api_instance = voucherify.CampaignsApi(api_client)

try:
result = customers_api_instance.list_customers()
print(result)

except voucherifyClient.ApiException as e:
self.fail(e)
try:
result = campaigns_api_instance.list_campaigns()
print(result)
except voucherify.ApiException as e:
print(f"Exception when calling CampaignsApi->list_campaigns: {e}")
```

> [!NOTE]
>
> This code just lists campaigns, so it won't affect your Voucherify data.

> [!TIP]
>
> Check the test implementation in the [Test folder](./__tests__).
Expand All @@ -121,10 +112,39 @@ This SDK is generated automatically from our [OpenAPI specification](https://git

## 🏷️ Link tags

[OpenAPI generated from tag](https://github.com/voucherifyio/voucherify-openapi/releases/tag/sdk-python-6.0.0).
[OpenAPI generated from tag](https://github.com/voucherifyio/voucherify-openapi/tree/sdk-python-6.1.0).

## 📅 Changelog

- **2026-08-10** - `6.1.0`
ADDED:
New models:
- `*OrderItems*ApplicableToItem` models (24) for loyalty earning rules — typed items for `applicable_to` on order-items amount, quantity, and subtotal amount schemas across create/get/update/enable/disable request and response bodies.

New properties:
- `points_formula` across loyalty earning rule schemas (base, custom event/customer/order metadata, order amount/total amount, order items amount/quantity/subtotal amount, and Loyalties earning-rules create/update/get/enable/disable request/response variants).
- `applicable_to` on order-items-based loyalty earning rule schemas (amount, quantity, subtotal amount) — alternative to single `object` + `id` targeting.
- Campaign budget limit fields on `ApplicableTo` and `InapplicableTo` (`product_*_quantity_limit`, `product_*_quantity_limit_formula`, and promotion-tier/collection variants).
- `applicable_redeemables_category_limits` on `StackingRules` and `ManagementProjectsStackingRules*` models.
- `updated_at` on `SegmentsCreateResponseBody` and `SegmentsGetResponseBody`.
- `cockpit_preference_center_url` on customer assets models (`CustomerWithSummaryLoyaltyReferralsAssets`, `CustomersCreateResponseBodyAssets`, `CustomersGetResponseBodyAssets`, `CustomersUpdateResponseBodyAssets`).
- `campaign_id` on export parameter models (`ExportParameters`, `ExportsCreateRequestBodyParameters`, `ExportsCreateResponseBodyParameters`, `ExportsGetResponseBodyParameters`).
- `amount` on `VoucherBalance` (gift card credits added/subtracted in a transaction).

New enum values:
- `STANDALONE` on campaign create request bodies (`CampaignsCreateRequestBody`, `LoyaltiesCreateCampaignRequestBody`, `TemplatesCampaignsCampaignSetupCreateRequestBody`).
- `passive` on `SegmentsCreateRequestBody.type`.
- `ADD_SAME_ITEMS` on `Discount.effect` and validation response discount models (`ValidationsValidateResponseBodyRedeemablesItemResultDiscount`, `ClientValidationsValidateResponseBodyRedeemablesItemResultDiscount`).
- `no_effect` on `ValidationsRedeemableSkippedResultDetails.key`.

UPDATED:
- `CreatePublicationCampaign.count` maximum raised from 20 to 50.

FIXED:
- `RedemptionRewardResultParametersCoin.exchange_ratio` was typed as `int`, but the API returns fractional COIN reward ratios (e.g. `0.01` for pay-with-points). `list_redemptions` and other endpoints could fail Pydantic deserialization on real project data.
- `ValidationsRedeemableSkippedResultDetails.key` was missing `no_effect`, so deserializing a skipped redeemable with `"key": "no_effect"` raised `ValueError` and failed the entire `POST /v1/validations` or stackable `POST /v1/redemptions` response (when `redeemables_no_effect_rule` is `SKIP`, globally or via `no_effect_skip_categories`).
- `Discount.effect` (and validation response discount models) were missing `ADD_SAME_ITEMS`, so unit-discount responses using that effect failed deserialization.

- **2025-08-21** - `6.0.0`
ADDED:
New models:
Expand Down
2 changes: 1 addition & 1 deletion __tests__/spec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

load_dotenv()

HOST = os.getenv("VOUCHERIFY_HOST", "https://api.voucherify.io")
HOST = os.getenv("VOUCHERIFY_HOST", "https://api.voucherify.io").strip().rstrip("/")
X_APP_ID = os.getenv("X_APP_ID")
X_APP_TOKEN = os.getenv("X_APP_TOKEN")

Expand Down
2 changes: 1 addition & 1 deletion docs/AccessSettingsCampaignAssignmentsList.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AccessSettingsCampaignAssignmentsList

Lists all assignments of the campaign to areas and stores. For [GET List Campaigns](ref:list-campaigns), this is returned if the `expand=access_settings_assignments` query parameter is passed in the request. This object is not returned for the [GET Campaign summary endpoint](ref:get-campaign-summary). **NOTE**: This object is returned only if the Areas and Stores enterprise feature is enabled. Contact [Voucherify Sales](https://www.voucherify.io/contact-sales) to learn more.
Lists all assignments of the campaign to areas and stores. For [GET List Campaigns](/api-reference/campaigns/list-campaigns), this is returned if the `expand=access_settings_assignments` query parameter is passed in the request. This object is not returned for the [GET Campaign summary endpoint](/api-reference/campaigns/get-campaign-summary). **NOTE**: This object is returned only if the Areas and Stores enterprise feature is enabled. Contact [Voucherify Sales](https://www.voucherify.io/contact-sales) to learn more.

## Properties

Expand Down
18 changes: 17 additions & 1 deletion docs/ApplicableTo.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,28 @@ Name | Type | Description | Notes
**product_id** | **str** | Parent product's unique ID assigned by Voucherify. | [optional]
**product_source_id** | **str** | Parent product's source ID from your inventory system. | [optional]
**price** | **float** | 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. | [optional]
**price_formula** | **float** | Formula used to calculate the discounted price of an item. | [optional]
**price_formula** | **float** | Formula used to dynamically calculate the discounted price of an item. | [optional]
**effect** | [**ApplicableToEffect**](ApplicableToEffect.md) | |
**quantity_limit** | **int** | The maximum number of units allowed to be discounted per order line item. | [optional]
**aggregated_quantity_limit** | **int** | The maximum number of units allowed to be discounted combined across all matched order line items. | [optional]
**amount_limit** | **int** | 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. | [optional]
**aggregated_amount_limit** | **int** | 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: - `APPLY_TO_ITEMS` (each item subtotal is discounted equally) - `APPLY_TO_ITEMS_BY_QUANTITY` (each unit of matched products has the same discount value) | [optional]
**product_campaign_quantity_limit** | **int** | Limits the number of discounted item units (product, SKU, collection) that all customers can receive in a given campaign. If a product is selected, the limit covers all discounts across all SKUs belonging to that product. If a product collection is selected, the limit covers all products/SKUs within the collection. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_campaign_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per campaign. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_customer_campaign_quantity_limit** | **int** | Limits the number of discounted item units (product, SKU, collection) that one customer can receive in a given campaign. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_customer_campaign_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per customer in a campaign. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_campaign_quantity_limit** | **int** | Limits the number of discounted item units of a given product in a collection that all customers can receive in a given campaign. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_campaign_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per campaign for a product in a collection. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_customer_campaign_quantity_limit** | **int** | Limits the number of discounted item units of a given product in a collection that one customer can receive in a campaign. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_customer_campaign_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per customer for a product in a collection. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_promotion_tier_quantity_limit** | **int** | Limits the number of discounted item units that all customers can receive in a promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_promotion_tier_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_customer_promotion_tier_quantity_limit** | **int** | Limits the number of discounted item units that one customer can receive in a given promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_customer_promotion_tier_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per customer in a promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_promotion_tier_quantity_limit** | **int** | Limits the number of discounted item units of a given product in a collection that all customers can receive in a given promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_promotion_tier_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per promotion tier for a product in a collection. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_customer_promotion_tier_quantity_limit** | **int** | Limits the number of discounted item units of a given product in a collection that one customer can receive in a promotion tier. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**product_in_collection_customer_promotion_tier_quantity_limit_formula** | **str** | Formula used to dynamically calculate the maximum units per customer in a promotion tier for a product in a collection. This limit is available on demand as part of campaign budget limits. Contact [Voucherify support](https://www.voucherify.io/contact-support) or your account manager to learn more. | [optional]
**order_item_indices** | **List[int]** | Lists which order lines are (not) covered by the discount. The order in the array is determined by the sequence of applied discounts, while the numbers correspond to the order lines sent in the `order` object in the request. The first order line is assigned `0`, the second order line is assigned `1`, and so on. | [optional]
**order_item_units** | [**List[ApplicableToOrderItemUnitsItem]**](ApplicableToOrderItemUnitsItem.md) | Lists which units within order lines are covered by the discount. The order line items are listed according to sequence of applied discounts while the `index` corresponds to the order line sent in the `order` object in the request. | [optional]
**repeat** | **int** | Determines the recurrence of the discount, e.g. `\"repeat\": 3` means that the discount is applied to every third item. | [optional]
Expand Down
6 changes: 3 additions & 3 deletions docs/AsyncActionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Method | HTTP request | Description

Get Async Action

Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).
Check the result of a scheduled asynchronous operation. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action.

### Example

Expand Down Expand Up @@ -99,7 +99,7 @@ Name | Type | Description | Notes

List Async Actions

Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).
Track asynchronous operations scheduled in your project. The table below lists the possible types of async actions. The types are different for each endpoint generating the async action.

### Example

Expand Down Expand Up @@ -178,7 +178,7 @@ Name | Type | Description | Notes

| Status code | Description | Response headers |
|-------------|-------------|------------------|
**2XX** | Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the <!-- [Get Async Action](OpenAPI.json/paths/~1async-actions~1{asyncActionId}/get) -->[Get Async Action](ref:get-async-action) endpoint. | - |
**2XX** | Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the [Get Async Action](/api-reference/async-actions/get-async-action) endpoint. | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

Loading