commercetools.pricingdiscount
Module commercetools.pricingdiscount
API
Definitions
ballerinax/commercetools.pricingdiscount Ballerina library
Overview
commercetools is a composable commerce platform that provides API-first building blocks for online storefronts, carts, orders, customers and catalogs. Its pricing and discount features let merchants run promotions on carts and products, issue discount codes, and manage the tax categories and rates used to price orders.
The commercetools Pricing and Discount connector lets Ballerina applications manage cart discounts, discount codes, product discounts and tax categories in a commercetools Project. It supports version 1 of the commercetools HTTP API.
Key features
- Create, query, update and delete cart discounts, by ID or by key
- Create, query, update and delete discount codes that apply cart discounts at checkout
- Manage product discounts and look up the discount that matches a product price
- Maintain tax categories and their tax rates with versioned update actions that protect against concurrent modification
- Authenticate with the OAuth 2.0 client credentials grant using a commercetools API client
Setup guide
To use the commercetools Pricing and Discount connector, you need a commercetools Project and an API client that can access its discounts and tax categories. If you do not have a commercetools account, you can sign up for a trial here.
Step 1: Create an API client
-
Open the Merchant Center and select your Project.
-
Go to Settings → Developer settings and select Create new API client.
-
Give the client a name and select the scopes for the resources you use:
view_cart_discountsandmanage_cart_discounts,view_discount_codesandmanage_discount_codes,view_product_discountsandmanage_product_discounts, andview_tax_categoriesandmanage_tax_categories.
Step 2: Note down the credentials
After the client is created, copy the following values. The client secret is shown only once.
- Project key
- Client ID
- Client secret
- Auth URL, for example
https://auth.europe-west1.gcp.commercetools.com - API URL, for example
https://api.europe-west1.gcp.commercetools.com
The token URL is the auth URL followed by /oauth/token.
Quickstart
To use the commercetools Pricing and Discount connector in your Ballerina application, update the .bal file as follows:
Step 1: Import the module
Import the commercetools.pricingdiscount module.
import ballerinax/commercetools.pricingdiscount;
Step 2: Instantiate a new connector
- Create a
Config.tomlfile and configure the credentials obtained in the steps above:
clientId = "<Client ID>" clientSecret = "<Client Secret>" tokenUrl = "<Auth URL>/oauth/token" apiUrl = "<API URL>" projectKey = "<Project key>"
- Create a
pricingdiscount:ConnectionConfigwith the OAuth 2.0 client credentials and initialize the connector with it.
configurable string clientId = ?; configurable string clientSecret = ?; configurable string tokenUrl = ?; configurable string apiUrl = ?; configurable string projectKey = ?; final pricingdiscount:Client commercetools = check new ({ auth: { tokenUrl, clientId, clientSecret } }, apiUrl);
Step 3: Invoke the connector operation
Now, utilize the available connector operations.
List the cart discounts
public function main() returns error? { pricingdiscount:CartDiscountPagedQueryResponse _ = check commercetools->listCartDiscounts(projectKey); }
Step 4: Run the Ballerina application
bal run
Examples
The commercetools Pricing and Discount connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
-
Discount catalog review - List the cart discounts, product discounts and discount codes of a Project, and fail when an active discount code refers to a cart discount that is missing or inactive.
-
Tax category setup - Create a tax category with a German rate, add a French rate with a versioned update action, verify both rates and optionally delete the category.
Clients
commercetools.pricingdiscount: Client
Constructor
Gets invoked to initialize the connector.
init (ConnectionConfig config, string serviceUrl)- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://api.us-central1.gcp.commercetools.com" - URL of the target service
listCartDiscounts
function listCartDiscounts(string projectKey, map<string|string[]> headers, *ListCartDiscountsQueries queries) returns CartDiscountPagedQueryResponse|errorQuery cart discounts
Parameters
- projectKey string -
keyof the Project
- queries *ListCartDiscountsQueries - Queries to be sent with the request
Return Type
- CartDiscountPagedQueryResponse|error - A paged list of cart discounts
createCartDiscount
function createCartDiscount(string projectKey, CartDiscountDraft payload, map<string|string[]> headers, *CreateCartDiscountQueries queries) returns CartDiscount|errorCreate a cart discount
Parameters
- projectKey string -
keyof the Project
- payload CartDiscountDraft - Cart discount draft to create
- queries *CreateCartDiscountQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The created cart discount
getCartDiscountByKey
function getCartDiscountByKey(string projectKey, string 'key, map<string|string[]> headers, *GetCartDiscountByKeyQueries queries) returns CartDiscount|errorGet a cart discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *GetCartDiscountByKeyQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
updateCartDiscountByKey
function updateCartDiscountByKey(string projectKey, string 'key, CartDiscountUpdate payload, map<string|string[]> headers, *UpdateCartDiscountByKeyQueries queries) returns CartDiscount|errorUpdate a cart discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- payload CartDiscountUpdate - Version and update actions for the cart discount
- queries *UpdateCartDiscountByKeyQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
deleteCartDiscountByKey
function deleteCartDiscountByKey(string projectKey, string 'key, map<string|string[]> headers, *DeleteCartDiscountByKeyQueries queries) returns CartDiscount|errorDelete a cart discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *DeleteCartDiscountByKeyQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
getCartDiscountById
function getCartDiscountById(string projectKey, string id, map<string|string[]> headers, *GetCartDiscountByIdQueries queries) returns CartDiscount|errorGet a cart discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *GetCartDiscountByIdQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
updateCartDiscountById
function updateCartDiscountById(string projectKey, string id, CartDiscountUpdate payload, map<string|string[]> headers, *UpdateCartDiscountByIdQueries queries) returns CartDiscount|errorUpdate a cart discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- payload CartDiscountUpdate - Version and update actions for the cart discount
- queries *UpdateCartDiscountByIdQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
deleteCartDiscountById
function deleteCartDiscountById(string projectKey, string id, map<string|string[]> headers, *DeleteCartDiscountByIdQueries queries) returns CartDiscount|errorDelete a cart discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *DeleteCartDiscountByIdQueries - Queries to be sent with the request
Return Type
- CartDiscount|error - The cart discount
listDiscountCodes
function listDiscountCodes(string projectKey, map<string|string[]> headers, *ListDiscountCodesQueries queries) returns DiscountCodePagedQueryResponse|errorQuery discount codes
Parameters
- projectKey string -
keyof the Project
- queries *ListDiscountCodesQueries - Queries to be sent with the request
Return Type
- DiscountCodePagedQueryResponse|error - A paged list of discount codes
createDiscountCode
function createDiscountCode(string projectKey, DiscountCodeDraft payload, map<string|string[]> headers, *CreateDiscountCodeQueries queries) returns DiscountCode|errorCreate a discount code
Parameters
- projectKey string -
keyof the Project
- payload DiscountCodeDraft - Discount code draft to create
- queries *CreateDiscountCodeQueries - Queries to be sent with the request
Return Type
- DiscountCode|error - The created discount code
getDiscountCodeById
function getDiscountCodeById(string projectKey, string id, map<string|string[]> headers, *GetDiscountCodeByIdQueries queries) returns DiscountCode|errorGet a discount code by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *GetDiscountCodeByIdQueries - Queries to be sent with the request
Return Type
- DiscountCode|error - The discount code
updateDiscountCodeById
function updateDiscountCodeById(string projectKey, string id, DiscountCodeUpdate payload, map<string|string[]> headers, *UpdateDiscountCodeByIdQueries queries) returns DiscountCode|errorUpdate a discount code by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- payload DiscountCodeUpdate - Version and update actions for the discount code
- queries *UpdateDiscountCodeByIdQueries - Queries to be sent with the request
Return Type
- DiscountCode|error - The discount code
deleteDiscountCodeById
function deleteDiscountCodeById(string projectKey, string id, map<string|string[]> headers, *DeleteDiscountCodeByIdQueries queries) returns DiscountCode|errorDelete a discount code by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *DeleteDiscountCodeByIdQueries - Queries to be sent with the request
Return Type
- DiscountCode|error - The discount code
listProductDiscounts
function listProductDiscounts(string projectKey, map<string|string[]> headers, *ListProductDiscountsQueries queries) returns ProductDiscountPagedQueryResponse|errorQuery product discounts
Parameters
- projectKey string -
keyof the Project
- queries *ListProductDiscountsQueries - Queries to be sent with the request
Return Type
- ProductDiscountPagedQueryResponse|error - A paged list of product discounts
createProductDiscount
function createProductDiscount(string projectKey, ProductDiscountDraft payload, map<string|string[]> headers, *CreateProductDiscountQueries queries) returns ProductDiscount|errorCreate a product discount
Parameters
- projectKey string -
keyof the Project
- payload ProductDiscountDraft - Product discount draft to create
- queries *CreateProductDiscountQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The created product discount
getProductDiscountByKey
function getProductDiscountByKey(string projectKey, string 'key, map<string|string[]> headers, *GetProductDiscountByKeyQueries queries) returns ProductDiscount|errorGet a product discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *GetProductDiscountByKeyQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
updateProductDiscountByKey
function updateProductDiscountByKey(string projectKey, string 'key, ProductDiscountUpdate payload, map<string|string[]> headers, *UpdateProductDiscountByKeyQueries queries) returns ProductDiscount|errorUpdate a product discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- payload ProductDiscountUpdate - Version and update actions for the product discount
- queries *UpdateProductDiscountByKeyQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
deleteProductDiscountByKey
function deleteProductDiscountByKey(string projectKey, string 'key, map<string|string[]> headers, *DeleteProductDiscountByKeyQueries queries) returns ProductDiscount|errorDelete a product discount by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *DeleteProductDiscountByKeyQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
getMatchingProductDiscount
function getMatchingProductDiscount(string projectKey, ProductDiscountMatchQuery payload, map<string|string[]> headers) returns ProductDiscount|errorGet the product discount matching a product price
Parameters
- projectKey string -
keyof the Project
- payload ProductDiscountMatchQuery - Product and price to match against product discounts
Return Type
- ProductDiscount|error - The product discount
getProductDiscountById
function getProductDiscountById(string projectKey, string id, map<string|string[]> headers, *GetProductDiscountByIdQueries queries) returns ProductDiscount|errorGet a product discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *GetProductDiscountByIdQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
updateProductDiscountById
function updateProductDiscountById(string projectKey, string id, ProductDiscountUpdate payload, map<string|string[]> headers, *UpdateProductDiscountByIdQueries queries) returns ProductDiscount|errorUpdate a product discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- payload ProductDiscountUpdate - Version and update actions for the product discount
- queries *UpdateProductDiscountByIdQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
deleteProductDiscountById
function deleteProductDiscountById(string projectKey, string id, map<string|string[]> headers, *DeleteProductDiscountByIdQueries queries) returns ProductDiscount|errorDelete a product discount by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *DeleteProductDiscountByIdQueries - Queries to be sent with the request
Return Type
- ProductDiscount|error - The product discount
listTaxCategories
function listTaxCategories(string projectKey, map<string|string[]> headers, *ListTaxCategoriesQueries queries) returns TaxCategoryPagedQueryResponse|errorQuery tax categories
Parameters
- projectKey string -
keyof the Project
- queries *ListTaxCategoriesQueries - Queries to be sent with the request
Return Type
- TaxCategoryPagedQueryResponse|error - A paged list of tax categories
createTaxCategory
function createTaxCategory(string projectKey, TaxCategoryDraft payload, map<string|string[]> headers, *CreateTaxCategoryQueries queries) returns TaxCategory|errorCreate a tax category
Parameters
- projectKey string -
keyof the Project
- payload TaxCategoryDraft - Tax category draft to create
- queries *CreateTaxCategoryQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The created tax category
getTaxCategoryByKey
function getTaxCategoryByKey(string projectKey, string 'key, map<string|string[]> headers, *GetTaxCategoryByKeyQueries queries) returns TaxCategory|errorGet a tax category by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *GetTaxCategoryByKeyQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
updateTaxCategoryByKey
function updateTaxCategoryByKey(string projectKey, string 'key, TaxCategoryUpdate payload, map<string|string[]> headers, *UpdateTaxCategoryByKeyQueries queries) returns TaxCategory|errorUpdate a tax category by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- payload TaxCategoryUpdate - Version and update actions for the tax category
- queries *UpdateTaxCategoryByKeyQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
deleteTaxCategoryByKey
function deleteTaxCategoryByKey(string projectKey, string 'key, map<string|string[]> headers, *DeleteTaxCategoryByKeyQueries queries) returns TaxCategory|errorDelete a tax category by key
Parameters
- projectKey string -
keyof the Project
- 'key string - User-defined unique identifier of the resource
- queries *DeleteTaxCategoryByKeyQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
getTaxCategoryById
function getTaxCategoryById(string projectKey, string id, map<string|string[]> headers, *GetTaxCategoryByIdQueries queries) returns TaxCategory|errorGet a tax category by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *GetTaxCategoryByIdQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
updateTaxCategoryById
function updateTaxCategoryById(string projectKey, string id, TaxCategoryUpdate payload, map<string|string[]> headers, *UpdateTaxCategoryByIdQueries queries) returns TaxCategory|errorUpdate a tax category by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- payload TaxCategoryUpdate - Version and update actions for the tax category
- queries *UpdateTaxCategoryByIdQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
deleteTaxCategoryById
function deleteTaxCategoryById(string projectKey, string id, map<string|string[]> headers, *DeleteTaxCategoryByIdQueries queries) returns TaxCategory|errorDelete a tax category by ID
Parameters
- projectKey string -
keyof the Project
- id string - Unique identifier of the resource
- queries *DeleteTaxCategoryByIdQueries - Queries to be sent with the request
Return Type
- TaxCategory|error - The tax category
Records
commercetools.pricingdiscount: Address
Fields
- Fields Included from *BaseAddress
- country CountryCode
- lastName string
- city string
- postalCode string
- title string
- building string
- streetName string
- company string
- id string
- state string
- department string
- fax string
- key string
- email string
- pOBox string
- streetNumber string
- mobile string
- externalId string
- additionalAddressInfo string
- firstName string
- phone string
- additionalStreetInfo string
- salutation string
- region string
- apartment string
- anydata...
- country? CountryCode -
- lastName? string -
- city? string -
- postalCode? string -
- title? string -
- building? string -
- streetName? string -
- company? string -
- id? string -
- state? string -
- department? string -
- fax? string -
- 'key? string -
- email? string -
- pOBox? string -
- streetNumber? string -
- custom? CustomFields -
- mobile? string -
- externalId? string -
- additionalAddressInfo? string -
- firstName? string -
- phone? string -
- additionalStreetInfo? string -
- salutation? string -
- region? string -
- apartment? string -
commercetools.pricingdiscount: Attribution
Fields
- clientId? string -
- 'source AttributionSource -
commercetools.pricingdiscount: BaseAddress
Fields
- country CountryCode -
- lastName? string -
- city? string -
- postalCode? string -
- title? string -
- building? string -
- streetName? string -
- company? string -
- id? string -
- state? string -
- department? string -
- fax? string -
- 'key? string -
- email? string -
- pOBox? string -
- streetNumber? string -
- mobile? string -
- externalId? string -
- additionalAddressInfo? string -
- firstName? string -
- phone? string -
- additionalStreetInfo? string -
- salutation? string -
- region? string -
- apartment? string -
commercetools.pricingdiscount: BaseResource
Fields
- createdAt string -
- lastModifiedAt string -
- id string -
- version int -
commercetools.pricingdiscount: CartDiscount
Fields
- Fields Included from *BaseResource
- requiresDiscountCode boolean -
- lastModifiedAt string -
- references Reference[] -
- cartPredicate string -
- stores StoreKeyReference[] -
- lastModifiedBy? LastModifiedBy -
- custom? CustomFields -
- description? LocalizedString -
- validFrom? string -
- isActive boolean -
- recurringOrderScope RecurringOrderScope -
- version int -
- target? CartDiscountTarget -
- createdAt string -
- createdBy? CreatedBy -
- sortOrder string -
- stackingMode StackingMode -
- name LocalizedString -
- validUntil? string -
- id string -
- value CartDiscountValue -
- 'key? string -
- discountGroup? DiscountGroupReference -
commercetools.pricingdiscount: CartDiscountDraft
Fields
- requiresDiscountCode? boolean -
- cartPredicate string -
- stores? StoreResourceIdentifier[] -
- custom? CustomFieldsDraft -
- description? LocalizedString -
- validFrom? string -
- isActive? boolean -
- recurringOrderScope? RecurringOrderScopeDraft -
- target? CartDiscountTarget -
- sortOrder? string -
- stackingMode? StackingMode -
- name LocalizedString -
- validUntil? string -
- value CartDiscountValueDraft -
- 'key? string -
- discountGroup? DiscountGroupResourceIdentifier -
commercetools.pricingdiscount: CartDiscountPagedQueryResponse
Fields
- total? int -
- offset int -
- 'limit int -
- count int -
- results CartDiscount[] -
commercetools.pricingdiscount: CartDiscountReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? CartDiscount -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: CartDiscountResourceIdentifier
Fields
- Fields Included from *ResourceIdentifier
- typeId ReferenceTypeId
- id string
- key string
- anydata...
- typeId? ReferenceTypeId -
- id? string -
- 'key? string -
commercetools.pricingdiscount: CartDiscountTarget
Fields
- 'type string -
commercetools.pricingdiscount: CartDiscountUpdate
Fields
- version int -
- actions CartDiscountUpdateAction[] -
commercetools.pricingdiscount: CartDiscountUpdateAction
Fields
- action string -
commercetools.pricingdiscount: CartDiscountValue
Fields
- 'type string -
commercetools.pricingdiscount: CartDiscountValueDraft
Fields
- 'type string -
commercetools.pricingdiscount: Channel
Fields
- Fields Included from *BaseResource
- lastModifiedAt string -
- address? Address -
- lastModifiedBy? LastModifiedBy -
- roles ChannelRoleEnum[] -
- custom? CustomFields -
- description? LocalizedString -
- version int -
- createdAt string -
- createdBy? CreatedBy -
- geoLocation? GeoJson -
- name? LocalizedString -
- id string -
- 'key string -
- reviewRatingStatistics? ReviewRatingStatistics -
commercetools.pricingdiscount: ChannelReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? Channel -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: ClientLogging
Fields
- anonymousId? string -
- clientId? string -
- externalUserId? string -
- associate? CustomerReference -
- customer? CustomerReference -
commercetools.pricingdiscount: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth OAuth2ClientCredentialsGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings(default {}) - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings(default {}) - Configurations related to HTTP/2 protocol
- timeout decimal(default 30) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded/x-forwardedheader
- followRedirects? FollowRedirects - Configurations associated with Redirection
- poolConfig? PoolConfiguration - Configurations associated with request pooling
- cache CacheConfig(default {}) - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding) header
- circuitBreaker? CircuitBreakerConfig - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig? RetryConfig - Configurations associated with retrying
- cookieConfig? CookieConfig - Configurations associated with cookies
- responseLimits ResponseLimitConfigs(default {}) - Configurations associated with inbound response size limits
- secureSocket? ClientSecureSocket - SSL/TLS-related options
- proxy? ProxyConfig - Proxy server related options
- socketConfig ClientSocketConfig(default {}) - Provides settings related to client socket configuration
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
- laxDataBinding boolean(default true) - Enables relaxed data binding on the client side. When enabled,
nilvalues are treated as optional, and absent fields are handled asnilabletypes. Enabled by default.
commercetools.pricingdiscount: CreateCartDiscountQueries
Represents the Queries record for the operation: createCartDiscount
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: CreatedBy
Fields
- Fields Included from *ClientLogging
- anonymousId string
- clientId string
- externalUserId string
- associate CustomerReference
- customer CustomerReference
- anydata...
- anonymousId? string -
- clientId? string -
- externalUserId? string -
- attributedTo? Attribution -
- associate? CustomerReference -
- customer? CustomerReference -
commercetools.pricingdiscount: CreateDiscountCodeQueries
Represents the Queries record for the operation: createDiscountCode
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: CreateProductDiscountQueries
Represents the Queries record for the operation: createProductDiscount
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: CreateTaxCategoryQueries
Represents the Queries record for the operation: createTaxCategory
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: Customer
Fields
- Fields Included from *BaseResource
- lastName? string -
- addresses Address[] -
- lastModifiedAt string -
- companyName? string -
- vatId? string -
- title? string -
- locale? Locale -
- shippingAddressIds string[] -
- isEmailVerified boolean -
- createdAt string -
- password? string -
- id string -
- authenticationMode AuthenticationMode -
- 'key? string -
- email string -
- customerGroup? CustomerGroupReference -
- stores StoreKeyReference[] -
- lastModifiedBy? LastModifiedBy -
- custom? CustomFields -
- externalId? string -
- dateOfBirth? string -
- customerGroupAssignments CustomerGroupAssignment[] -
- customerNumber? string -
- defaultShippingAddressId? string -
- billingAddressIds string[] -
- version int -
- defaultBillingAddressId? string -
- firstName? string -
- createdBy? CreatedBy -
- middleName? string -
- salutation? string -
commercetools.pricingdiscount: CustomerGroup
Fields
- Fields Included from *BaseResource
- createdAt string -
- lastModifiedAt string -
- createdBy? CreatedBy -
- lastModifiedBy? LastModifiedBy -
- custom? CustomFields -
- name string -
- id string -
- version int -
- 'key? string -
commercetools.pricingdiscount: CustomerGroupAssignment
Fields
- customerGroup CustomerGroupReference -
commercetools.pricingdiscount: CustomerGroupReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? CustomerGroup -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: CustomerReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? Customer -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: CustomFields
Fields
- 'type TypeReference -
- fields FieldContainer -
commercetools.pricingdiscount: CustomFieldsDraft
Fields
- 'type TypeResourceIdentifier -
- fields? FieldContainer -
commercetools.pricingdiscount: DeleteCartDiscountByIdQueries
Represents the Queries record for the operation: deleteCartDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DeleteCartDiscountByKeyQueries
Represents the Queries record for the operation: deleteCartDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DeleteDiscountCodeByIdQueries
Represents the Queries record for the operation: deleteDiscountCodeById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
- dataErasure? boolean - Whether to erase all personal data related to the resource. Default
false
commercetools.pricingdiscount: DeleteProductDiscountByIdQueries
Represents the Queries record for the operation: deleteProductDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DeleteProductDiscountByKeyQueries
Represents the Queries record for the operation: deleteProductDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DeleteTaxCategoryByIdQueries
Represents the Queries record for the operation: deleteTaxCategoryById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DeleteTaxCategoryByKeyQueries
Represents the Queries record for the operation: deleteTaxCategoryByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- version int - Expected current version of the resource, for optimistic concurrency control
commercetools.pricingdiscount: DiscountCode
Fields
- Fields Included from *BaseResource
- cartDiscounts CartDiscountReference[] -
- applicationVersion? int -
- lastModifiedAt string -
- code string -
- references Reference[] -
- cartPredicate? string -
- stores StoreKeyReference[] -
- lastModifiedBy? LastModifiedBy -
- custom? CustomFields -
- description? LocalizedString -
- groups string[] -
- validFrom? string -
- isActive boolean -
- version int -
- maxApplications? int -
- createdAt string -
- createdBy? CreatedBy -
- name? LocalizedString -
- validUntil? string -
- id string -
- maxApplicationsPerCustomer? int -
- 'key? string -
commercetools.pricingdiscount: DiscountCodeDraft
Fields
- cartDiscounts CartDiscountResourceIdentifier[] -
- code string -
- cartPredicate? string -
- custom? CustomFieldsDraft -
- description? LocalizedString -
- groups? string[] -
- validFrom? string -
- isActive? boolean -
- maxApplications? int -
- name? LocalizedString -
- validUntil? string -
- maxApplicationsPerCustomer? int -
- 'key? string -
commercetools.pricingdiscount: DiscountCodePagedQueryResponse
Fields
- total? int -
- offset int -
- 'limit int -
- count int -
- results DiscountCode[] -
commercetools.pricingdiscount: DiscountCodeUpdate
Fields
- version int -
- actions DiscountCodeUpdateAction[] -
commercetools.pricingdiscount: DiscountCodeUpdateAction
Fields
- action string -
commercetools.pricingdiscount: DiscountedPriceDraft
Fields
- discount ProductDiscountReference -
- value Money -
commercetools.pricingdiscount: DiscountGroup
Fields
- Fields Included from *BaseResource
- createdAt string -
- lastModifiedAt string -
- createdBy? CreatedBy -
- sortOrder string -
- lastModifiedBy? LastModifiedBy -
- name? LocalizedString -
- description? LocalizedString -
- id string -
- isActive boolean -
- version int -
- 'key string -
commercetools.pricingdiscount: DiscountGroupReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? DiscountGroup -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: DiscountGroupResourceIdentifier
Fields
- Fields Included from *ResourceIdentifier
- typeId ReferenceTypeId
- id string
- key string
- anydata...
- typeId? ReferenceTypeId -
- id? string -
- 'key? string -
commercetools.pricingdiscount: FieldContainer
Fields
- string... - Rest field
commercetools.pricingdiscount: FieldDefinition
Fields
- name string -
- inputHint? TypeTextInputHint -
- label LocalizedString -
- 'type FieldType -
- required boolean -
commercetools.pricingdiscount: FieldType
Fields
- name string -
commercetools.pricingdiscount: GeoJson
Fields
- 'type string -
commercetools.pricingdiscount: GetCartDiscountByIdQueries
Represents the Queries record for the operation: getCartDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetCartDiscountByKeyQueries
Represents the Queries record for the operation: getCartDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetDiscountCodeByIdQueries
Represents the Queries record for the operation: getDiscountCodeById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetProductDiscountByIdQueries
Represents the Queries record for the operation: getProductDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetProductDiscountByKeyQueries
Represents the Queries record for the operation: getProductDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetTaxCategoryByIdQueries
Represents the Queries record for the operation: getTaxCategoryById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: GetTaxCategoryByKeyQueries
Represents the Queries record for the operation: getTaxCategoryByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: KeyReference
Fields
- typeId ReferenceTypeId -
- 'key string -
commercetools.pricingdiscount: LastModifiedBy
Fields
- Fields Included from *ClientLogging
- anonymousId string
- clientId string
- externalUserId string
- associate CustomerReference
- customer CustomerReference
- anydata...
- anonymousId? string -
- clientId? string -
- externalUserId? string -
- attributedTo? Attribution -
- associate? CustomerReference -
- customer? CustomerReference -
commercetools.pricingdiscount: ListCartDiscountsQueries
Represents the Queries record for the operation: listCartDiscounts
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- offset? int - Number of results to skip, for paging. Default 0, maximum 10000
- withTotal? boolean - Whether to calculate and return
totalin the response. Defaulttrue
- 'limit? int - Maximum number of results to return. Default 20, maximum 500
- 'where? string[] - Query predicate that filters the results. Can be repeated
- sort? string[] - Sort expression, such as
createdAt desc. Can be repeated
commercetools.pricingdiscount: ListDiscountCodesQueries
Represents the Queries record for the operation: listDiscountCodes
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- offset? int - Number of results to skip, for paging. Default 0, maximum 10000
- withTotal? boolean - Whether to calculate and return
totalin the response. Defaulttrue
- 'limit? int - Maximum number of results to return. Default 20, maximum 500
- 'where? string[] - Query predicate that filters the results. Can be repeated
- sort? string[] - Sort expression, such as
createdAt desc. Can be repeated
commercetools.pricingdiscount: ListProductDiscountsQueries
Represents the Queries record for the operation: listProductDiscounts
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- offset? int - Number of results to skip, for paging. Default 0, maximum 10000
- withTotal? boolean - Whether to calculate and return
totalin the response. Defaulttrue
- 'limit? int - Maximum number of results to return. Default 20, maximum 500
- 'where? string[] - Query predicate that filters the results. Can be repeated
- sort? string[] - Sort expression, such as
createdAt desc. Can be repeated
commercetools.pricingdiscount: ListTaxCategoriesQueries
Represents the Queries record for the operation: listTaxCategories
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
- offset? int - Number of results to skip, for paging. Default 0, maximum 10000
- withTotal? boolean - Whether to calculate and return
totalin the response. Defaulttrue
- 'limit? int - Maximum number of results to return. Default 20, maximum 500
- 'where? string[] - Query predicate that filters the results. Can be repeated
- sort? string[] - Sort expression, such as
createdAt desc. Can be repeated
commercetools.pricingdiscount: LocalizedString
Fields
- string... - Rest field
commercetools.pricingdiscount: Money
Fields
- centAmount int -
- currencyCode CurrencyCode -
commercetools.pricingdiscount: OAuth2ClientCredentialsGrantConfig
OAuth2 Client Credentials Grant Configs
Fields
- Fields Included from *OAuth2ClientCredentialsGrantConfig
- tokenUrl string(default "https://auth.us-central1.gcp.commercetools.com/oauth/token") - Token URL
commercetools.pricingdiscount: PriceTierDraft
Fields
- minimumQuantity int -
- value Money -
commercetools.pricingdiscount: ProductDiscount
Fields
- Fields Included from *BaseResource
- lastModifiedAt string -
- references Reference[] -
- lastModifiedBy? LastModifiedBy -
- description? LocalizedString -
- validFrom? string -
- isActive boolean -
- version int -
- createdAt string -
- predicate string -
- createdBy? CreatedBy -
- sortOrder string -
- name LocalizedString -
- validUntil? string -
- id string -
- value ProductDiscountValue -
- 'key? string -
commercetools.pricingdiscount: ProductDiscountDraft
Fields
- predicate string -
- sortOrder string -
- name LocalizedString -
- description? LocalizedString -
- validUntil? string -
- validFrom? string -
- isActive boolean -
- value ProductDiscountValueDraft -
- 'key? string -
commercetools.pricingdiscount: ProductDiscountMatchQuery
Fields
- productId string -
- price QueryPrice -
- variantId Signed32 -
- staged boolean -
commercetools.pricingdiscount: ProductDiscountPagedQueryResponse
Fields
- total? int -
- offset int -
- 'limit int -
- count int -
- results ProductDiscount[] -
commercetools.pricingdiscount: ProductDiscountReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? ProductDiscount -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: ProductDiscountUpdate
Fields
- version int -
- actions ProductDiscountUpdateAction[] -
commercetools.pricingdiscount: ProductDiscountUpdateAction
Fields
- action string -
commercetools.pricingdiscount: ProductDiscountValue
Fields
- 'type string -
commercetools.pricingdiscount: ProductDiscountValueDraft
Fields
- 'type string -
commercetools.pricingdiscount: QueryPrice
Fields
- discounted? DiscountedPriceDraft -
- country? CountryCode -
- tiers? PriceTierDraft[] -
- customerGroup? CustomerGroupReference -
- custom? CustomFields -
- channel? ChannelReference -
- validUntil? string -
- id? string -
- validFrom? string -
- value Money -
commercetools.pricingdiscount: RecurringOrderScope
Fields
- 'type string -
commercetools.pricingdiscount: RecurringOrderScopeDraft
Fields
- 'type string -
commercetools.pricingdiscount: Reference
Fields
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: ResourceIdentifier
Fields
- typeId ReferenceTypeId -
- id? string -
- 'key? string -
commercetools.pricingdiscount: ReviewRatingStatistics
Fields
- highestRating decimal -
- averageRating decimal -
- count Signed32 -
- lowestRating decimal -
- ratingsDistribution record {} -
commercetools.pricingdiscount: StoreKeyReference
Fields
- Fields Included from *KeyReference
- typeId ReferenceTypeId
- key string
- anydata...
- typeId ReferenceTypeId -
- 'key string -
commercetools.pricingdiscount: StoreResourceIdentifier
Fields
- Fields Included from *ResourceIdentifier
- typeId ReferenceTypeId
- id string
- key string
- anydata...
- typeId? ReferenceTypeId -
- id? string -
- 'key? string -
commercetools.pricingdiscount: SubRate
Fields
- amount decimal -
- name string -
commercetools.pricingdiscount: TaxCategory
Fields
- Fields Included from *BaseResource
- createdAt string -
- lastModifiedAt string -
- createdBy? CreatedBy -
- lastModifiedBy? LastModifiedBy -
- rates TaxRate[] -
- name string -
- description? string -
- id string -
- version int -
- 'key? string -
commercetools.pricingdiscount: TaxCategoryDraft
Fields
- rates? TaxRateDraft[] -
- name string -
- description? string -
- 'key? string -
commercetools.pricingdiscount: TaxCategoryPagedQueryResponse
Fields
- total? int -
- offset int -
- 'limit int -
- count int -
- results TaxCategory[] -
commercetools.pricingdiscount: TaxCategoryUpdate
Fields
- version int -
- actions TaxCategoryUpdateAction[] -
commercetools.pricingdiscount: TaxCategoryUpdateAction
Fields
- action string -
commercetools.pricingdiscount: TaxRate
Fields
- country CountryCode -
- amount decimal -
- includedInPrice boolean -
- name string -
- id? string -
- state? string -
- 'key? string -
- subRates? SubRate[] -
- taxRoundingTarget? TaxRoundingTarget -
commercetools.pricingdiscount: TaxRateDraft
Fields
- country CountryCode -
- amount? decimal -
- includedInPrice boolean -
- name string -
- state? string -
- 'key? string -
- subRates? SubRate[] -
- taxRoundingTarget? TaxRoundingTarget -
commercetools.pricingdiscount: Type
Fields
- Fields Included from *BaseResource
- createdAt string -
- lastModifiedAt string -
- createdBy? CreatedBy -
- lastModifiedBy? LastModifiedBy -
- name LocalizedString -
- description? LocalizedString -
- fieldDefinitions FieldDefinition[] -
- id string -
- version int -
- 'key string -
- resourceTypeIds ResourceTypeId[] -
commercetools.pricingdiscount: TypeReference
Fields
- Fields Included from *Reference
- typeId ReferenceTypeId
- id string
- anydata...
- obj? Type -
- typeId ReferenceTypeId -
- id string -
commercetools.pricingdiscount: TypeResourceIdentifier
Fields
- Fields Included from *ResourceIdentifier
- typeId ReferenceTypeId
- id string
- key string
- anydata...
- typeId? ReferenceTypeId -
- id? string -
- 'key? string -
commercetools.pricingdiscount: UpdateCartDiscountByIdQueries
Represents the Queries record for the operation: updateCartDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateCartDiscountByKeyQueries
Represents the Queries record for the operation: updateCartDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateDiscountCodeByIdQueries
Represents the Queries record for the operation: updateDiscountCodeById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateProductDiscountByIdQueries
Represents the Queries record for the operation: updateProductDiscountById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateProductDiscountByKeyQueries
Represents the Queries record for the operation: updateProductDiscountByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateTaxCategoryByIdQueries
Represents the Queries record for the operation: updateTaxCategoryById
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
commercetools.pricingdiscount: UpdateTaxCategoryByKeyQueries
Represents the Queries record for the operation: updateTaxCategoryByKey
Fields
- expand? string[] - Reference path to expand in the response. Can be repeated
Union types
commercetools.pricingdiscount: ChannelRoleEnum
ChannelRoleEnum
commercetools.pricingdiscount: ResourceTypeId
ResourceTypeId
commercetools.pricingdiscount: AuthenticationMode
AuthenticationMode
commercetools.pricingdiscount: TypeTextInputHint
TypeTextInputHint
commercetools.pricingdiscount: ReferenceTypeId
ReferenceTypeId
commercetools.pricingdiscount: TaxRoundingTarget
TaxRoundingTarget
commercetools.pricingdiscount: StackingMode
StackingMode
commercetools.pricingdiscount: AttributionSource
AttributionSource
String types
Import
import ballerinax/commercetools.pricingdiscount;Metadata
Released date: 1 day ago
Version: 2.0.0
License: Apache-2.0
Security
Direct vulnerabilities: No known direct vulnerabilities
Indirect vulnerabilities:
Checked on 2026-11-20 via OSV.dev
Compatibility
Platform: any
Ballerina version: 2201.12.0
GraalVM compatible: Yes
Pull count
Total: 52
Current verison: 1
Weekly downloads
Keywords
Vendor/Commercetools
Area/E-Commerce
Type/Connector
Contributors