The Coupon Redemption Search document contains a search object that allows filtering on various attributes.
The following searchable query attributes can be used to narrow down the search:
| Attribute | Type |
|---|---|
| code | String |
| couponId | String |
| customerEmail | String |
| orderNo | String |
Note that only searchable attributes can be used in sorting.
If the user role does not have the View_Coupon_Codes permission, then the returned coupon codes are masked.
If you would like to get a raw Response object use the other couponRedemptionsSearch function.
An object containing the options for this method.
A promise of type CouponRedemptionSearchResult.
The Coupon Redemption Search document contains a search object that allows filtering on various attributes.
The following searchable query attributes can be used to narrow down the search:
| Attribute | Type |
|---|---|
| code | String |
| couponId | String |
| customerEmail | String |
| orderNo | String |
Note that only searchable attributes can be used in sorting.
If the user role does not have the View_Coupon_Codes permission, then the returned coupon codes are masked.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type CouponRedemptionSearchResult otherwise.
The Coupon Search document contains a search object that allows filtering on various attributes.
The following searchable query attributes can be used to narrow the search:
| Attribute | Type |
|---|---|
| couponId | String |
| description | String |
| type | one of {"single_code", "multiple_codes", "system_codes"} |
| enabled | Boolean |
Note that only searchable attributes can be used in sorting.
If you would like to get a raw Response object use the other couponsSearch function.
An object containing the options for this method.
A promise of type CouponSearchResult.
The Coupon Search document contains a search object that allows filtering on various attributes.
The following searchable query attributes can be used to narrow the search:
| Attribute | Type |
|---|---|
| couponId | String |
| description | String |
| type | one of {"single_code", "multiple_codes", "system_codes"} |
| enabled | Boolean |
Note that only searchable attributes can be used in sorting.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type CouponSearchResult otherwise.
If you would like to get a raw Response object use the other createCoupon function.
An object containing the options for this method.
A promise of type Coupon.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type Coupon otherwise.
If you would like to get a raw Response object use the other deleteCoupon function.
An object containing the options for this method.
A promise of type void.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
If the user role does not have the View_Coupon_Codes permission, then the returned coupon codes are masked.
If you would like to get a raw Response object use the other getCoupon function.
An object containing the options for this method.
A promise of type Coupon.
If the user role does not have the View_Coupon_Codes permission, then the returned coupon codes are masked.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type Coupon otherwise.
If you would like to get a raw Response object use the other getCouponCodes function.
An object containing the options for this method.
A promise of type CouponCodes.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type CouponCodes otherwise.
Note: Coupon redemptions are evaluated during checkout. A large number of coupon redemptions negatively impacts order creation performance and scale.*
If you would like to get a raw Response object use the other redeemCoupon function.
An object containing the options for this method.
A promise of type void.
Note: Coupon redemptions are evaluated during checkout. A large number of coupon redemptions negatively impacts order creation performance and scale.*
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
If you would like to get a raw Response object use the other updateCoupon function.
An object containing the options for this method.
A promise of type Coupon.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type Coupon otherwise.
If you would like to get a raw Response object use the other updateCouponCodes function.
An object containing the options for this method.
A promise of type void.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Generated using TypeDoc
Coupons
*Download API specification
API Overview
Use the Coupons API to create, modify, retrieve, and delete coupons for a given channel. You can also use it to create and retrieve coupon codes using a couponID.
Coupons must be added as a qualifier to a campaign before they can be used.
For more information, see Using Coupons as Qualifiers in the B2C Commerce documentation.
Authentication & Authorization
The client requesting the coupon's information must have access to the Coupon resource. For resource access, you must use a client ID and client secret from Account Manager to request an access token. The access token is used as a bearer token and added to the Authorization header of your API request. The client must first authenticate against Account manager to log in.
You must include the relevant scope(s) in the client ID used to generate the token. For details, see Authorization Scopes Catalog.
For detailed setup instructions, see Authorization for Admin APIs.
Response Details
Timeouts
Admin API requests must respond within 60 seconds. If a response exceeds this threshold, an HTTP 504 status code is returned. For details, see Timeouts and Limits.
Error Handling
Error responses follow the RFC 7807 problem detail format. To trace errors, include a
correlation-idheader in your request — the response returns it asx-correlation-id. For details, see HTTP Status Codes and Errors.Use Cases
Single-Use Coupon
Single-use coupons are your standard coupons, which you can only use once per customer.
For example, use the Coupons API to create a coupon with a single coupon code that can be applied only once per order per customer.
Multiple-Use Coupon
A multiple-use coupon can be used any number of times by any number of customers.
For example, use the Coupons API to create a coupon that can be applied once per order and has system-generated codes.
Search Coupon
Use the Coupons API to search for coupons using simple or complex querying.
Search Coupon Redemptions
Use the Coupons API to search for coupon redemptions using simple or complex querying.
For more detail, see Coupon Redemption in the B2C Commerce documentation.
Related APIs
For instructions on how to retrieve access token for admin APIs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html
Example with admin auth
API Version: 1.4.4import { Coupons, ClientConfig } from "commerce-sdk"; // or const { Coupons, ClientConfig } = require("commerce-sdk"); const clientConfig: ClientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; token = { access_token: 'INSERT_ACCESS_TOKEN_HERE' }; clientConfig.headers['authorization'] = `Bearer ${token.access_token}`; const couponsClient = new Coupons(clientConfig);Last Updated: