Manage Flexible Discounts using APIs
You can use the following APIs to get details of available flexible discounts and apply them while placing an order or creating or modifying a subscription:
- Get Flexible Discounts
- Create Order and Preview Order
- Get Order
- Get Order History of a customer
- Preview Renewal
- Apply flexible discounts when placing manual renewal orders
- Create a subscription with flexible discount
- Update subscription with a flexible discount code
- Remove a flexible discount from a subscription
Get Flexible Discounts
Use the GET Flexible Discounts API to fetch flexible discounts that are applicable to a product:
Request
Sample Request URL: GET <ENV>/v3/flex-discounts?market-segment=COM&country=US
Query parameters
Note: Request query parameters such as Market segment and country are validated against the Partner contract data. You can also use other query parameters that are listed in the following table:
Sample request URLs
- Sample request URL with all query parameters:
<ENV>/v3/flex-discounts?categories=STANDARD&market-segment=COM&country=US&offer-ids=65322535CA04A12,86322535CA04A12&flex-discount-code=BLACK_FRIDAY&start-date=2025-03-01&end-date=2025-03-31&limit=20&offset=0 - Sample request URL where flexible discount ID is used:
<ENV>/v3/flex-discounts?country=US&market-segment=COM&flex-discount-id=55555555-1533-4564-ade1-cd6946a97f29
Request Header
See Headers section.
Request Body
None.
Response
{
"limit": 20,
"offset": 0,
"count": 3,
"totalCount": 3,
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0", // INTRO - Fixed Price
"category": "INTRO",
"code": "INTRO-PHSP",
"name": "Intro Discount - Photoshop",
"description": "Intro Discount - Photoshop - 15.99",
"startDate": "2025-11-30T23:59:59Z",
"endDate": "2026-12-31T23:59:59Z",
"qualification": {
"baseOfferIds": [
"11083117CA01A12"
]
},
"outcomes": [
{
"type": "FIXED_PRICE",
"discountValues": [
{
"country": "US",
"currency": "USD",
"value": 15.99
}
]
}
]
},
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0", // STANDARD - Fixed Discount
"category": "STANDARD",
"code": "BLACK_FRIDAY",
"name": "BLACK_FRIDAY",
"description": "BLACK_FRIDAY - 10 USD off PHSP",
"startDate": "2025-11-01T23:59:59Z",
"endDate": "2025-12-31T23:59:59Z",
"qualification": {
"baseOfferIds": [
"11083117CA01A12"
]
},
"outcomes": [
{
"type": "FIXED_DISCOUNT",
"discountValues": [
{
"country": "US",
"currency": "USD",
"value": 10.00
}
]
}
]
},
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0", // STANDARD - Percentage Discount
"category": "STANDARD",
"code": "NEW YEAR",
"name": "NEW YEAR",
"description": "NEW YEAR - 20% off on all Products",
"startDate": "2025-12-01T23:59:59Z",
"endDate": "2026-01-31T23:59:59Z",
"outcomes": [
{
"type": "PERCENTAGE_DISCOUNT",
"discountValues": [
{
"value": 20
}
]
}
]
}
],
"links": {
"self": {
"uri": "/v3/flex-discounts?customer-id=<>&categories=STANDARD,INTRO&limit=20&offset=20",
"method": "GET",
"headers": []
},
// next link will be present only if the next resource is present
"next": {
"uri": "/v3/flex-discounts?customer-id=<>&categories=STANDARD,INTRO&limit=20&offset=40",
"method": "GET",
"headers": []
},
// prev link will be present only if a previous resource is present
"prev": {
"uri": "/v3/flex-discounts?customer-id=<>&categories=STANDARD,INTRO&limit=20&offset=0",
"method": "GET",
"headers": []
}
}
}
Response parameters
flexDiscounts object
Sample Response (Failure)
On failure, the response includes the appropriate HTTP status code based on the reason or type of failure. For example, if the API key is invalid, the response has HTTP 403 (Forbidden):
{ "code": "4115", "message": "Api Key is invalid or missing" }
Create Order and Preview Order
Pass the flexDiscountCodes at the lineItems level in the Create Order and Preview Order requests.
/v3/customers/<customer-id>/ordersNotes:
- Order creation will fail even if any line item contains an invalid flexible discount code.
- Currently, only one flexible discount code is allowed per line item in Order Preview.
Request Header
See Headers section.
Request Body
The following sample request shows how to apply a flexible discount code to a Create Order request to get a discounted price:
{
"orderType": "NEW", // NEW or PREVIEW
"externalReferenceId": "759",
"currencyCode": "USD",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"currencyCode": "USD",
"flexDiscountCodes": ["SUMMER_SALE_123"]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"currencyCode": "USD",
"flexDiscountCodes": ["WINTER_SALE_123"]
}
]
}
The flexDiscountCodes parameter in the above request indicates the flexible discount codes applied to the Order.
Response
{
"referenceOrderId": "",
"orderType": "NEW",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "1002",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"status": "1002",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "SUMMER_SALE_123",
"result": "SUCCESS"
}
]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"status": "1002",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55522355-313b-476c-9d0b-7a710f4h83s4",
"code": "WINTER_SALE_123",
"result": "SUCCESS"
}
]
}
],
"links": { // As existing response fields }
}
The following table provides the flexible discount details included in the response:
HTTP Status Codes
Same as the standard Create Order request.
Get Order
The GET Order API response also includes the flexible discount applied to the order.
/v3/customers/<customer-id>/orders/<order-id>Request Header
See Headers section.
Request Body
None.
Response
{
"referenceOrderId": "",
"orderType": "NEW",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "1000",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "SUMMER_SALE_123",
"result": "SUCCESS"
}
]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55522355-313b-476c-9d0b-7a710f4h83s4",
"code": "WINTER_SALE_123",
"result": "SUCCESS"
}
]
}
],
"links": { // As existing response fields }
},
HTTP Status Codes
The same as the standard Get Order API.
Get Order History of a Customer
The Get Order History API retrieves past orders for a customer, including any applied flexible discounts.
/v3/customers/<customer-id>/ordersRequest Header
See Headers section.
Request Body
None.
Response
{
"items": [
{
"referenceOrderId": "",
"orderType": "NEW",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "1000",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "SUMMER_SALE_123",
"result": "SUCCESS"
}
]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55522355-313b-476c-9d0b-7a710f4h83s4",
"code": "WINTER_SALE_123",
"result": "SUCCESS"
}
]
}
],
"links": { // As existing response fields }
}
]
}
HTTP Status Codes
The same as the standard Get Order History API.
Preview renewal with flexible discount code
Eligibility for flexible discounts is validated in both automated preview renewal and manual preview renewals.
Note: The flexible discount codes included in the response apply only to renewal scenarios. They cannot be used when creating a new order.
Preview automated renewal
The POST /v3/customers/<customer-id>/orders API with the orderType as PREVIEW_RENEWAL is used in the request to verify the eligibility of the order, including validation of customer eligibility for the flexible discount code that is currently applied on the subscription.
Request
{
"orderType": "PREVIEW_RENEWAL"
}
Response
{
"referenceOrderId": "",
"orderType": "PREVIEW_RENEWAL",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "ABCD-XV54-HG34-78YT",
"result": "SUCCESS"
}
]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"status": "1000",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55522355-313b-476c-9d0b-7a710f4h83s4",
"code": "ABCD-XV54-HG34-78YT",
"result": "SUCCESS"
}
]
}
],
"links": { // As existing response fields }
}
Manual Preview Renewal Order with flexible discount code
Use the POST /v3/customers/<customer-id>/orders API with the orderType as PREVIEW_RENEWAL to manually preview the renewal order, including the eligibility of the customer for the flexible discount code included in the request.
Request
{
"orderType": "PREVIEW_RENEWAL",
"externalReferenceId": "759",
"currencyCode": "USD",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"currencyCode": "USD",
"subscriptionId": " e0b170437c4e96ac5428364f674dffNA",
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"currencyCode": "USD",
"subscriptionId": " fff170437c4e96ac5428364f674dfggg",
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
}
]
}
Response
{
"referenceOrderId": "",
"orderType": "PREVIEW_RENEWAL",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "1002",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567CA01A12",
"quantity": 1,
"status": "1002",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "ABCD-XV54-HG34-78YT",
"result": "SUCCESS"
}
]
},
{
"extLineItemNumber": 2,
"offerId": "80004561CA02A12",
"quantity": 11,
"status": "1002",
"subscriptionId": "",
"currencyCode": "USD",
"flexDiscounts": [
{
"id": "55522355-313b-476c-9d0b-7a710f4h83s4",
"code": "ABCD-XV54-HG34-78YT",
"result": "SUCCESS"
}
]
}
],
"links": { // As existing response fields }
}
Apply flexible discounts when placing manual renewal orders
You can apply a flexible discount to renewal orders, including late renewals, by specifying flexible discount codes at the line item level in the Create Order request. To do this, set orderType to RENEWAL and include flexDiscountCodes for the applicable line items.
/v3/customers/<customer-id>/ordersRequest:
The following sample request shows how to apply a flexible discount code to a Create Order request to get a discounted price:
{
"orderType": "RENEWAL",
"externalReferenceId": "759",
"currencyCode": "USD",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567EA01A12",
"subscriptionId": " e0b170437c4e96ac5428364f674dffNA ",
"flexDiscountCodes": ["SUMMER_SALE_12"],
"quantity": 1
}
]
}
Response:
{
"referenceOrderId": "",
"orderType": "RENEWAL",
"externalReferenceId": "759",
"customerId": "9876543210",
"orderId": "5120008001",
"currencyCode": "USD",
"creationDate": "2019-05-02T22:49:54Z",
"status": "1002",
"lineItems": [
{
"extLineItemNumber": 1,
"offerId": "80004567EA01A12",
"quantity": 1,
"status": "1002",
"subscriptionId": " e0b170437c4e96ac5428364f674dffNA ",
"flexDiscounts": [
{
"id": "55555555-313b-476c-9d0b-6a610d5b91e0",
"code": "SUMMER_SALE_12",
"result": "SUCCESS"
}
]
}
],
"links": { ... }
}
Apply flexible discounts on subscriptions
- Create Scheduled Subscription with flexible discount
- Update Subscription with a flexible discount code
- Remove flexible discount from a subscription
Create a scheduled subscription with flexible discount
You can use the POST /v3/customers/<customer-id>/subscriptions API with flexDiscountCodes in the request to create a subscription for a specific customer.
Note:
- Flexible discount codes are not validated while creating a subscription. Verification of customer eligibility occurs exclusively through the Preview Renewal API.
- A flexible discount code can be redeemed only once for a customer, thereby reducing the risk of unwanted code redemptions and thus preventing abuse.
Request
{
"offerId": "65304470CA01012",
"autoRenewal": {
"enabled": true,
"renewalQuantity": 100,
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
}
}
Response
{
"subscriptionId": "cc8efgh8bc4354a4b38006c87804ceNA",
"currentQuantity": 0,
"offerId": "65304470CA01012",
"autoRenewal": {
"enabled": true,
"renewalQuantity": 5,
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
},
"renewalDate": "2026-05-20",
"creationDate": "2025-10-20T22:49:55Z",
"status": "1009",
"links": {
"self": {
"uri": "/v3/customers/P1005053489/subscriptions/cc8efgh8bc4354a4b38006c87804ceNA",
"method": "GET",
"headers": []
}
}
}
Update a subscription with flexible discount code
Use the PATCH /v3/customers/<customer-id>/subscriptions/<subscription-id> API with flexDiscountCodes in the request to update a subscription with the corresponding flexible discount.
Note: Flexible discount codes are not validated while updating a subscription. Verification of customer eligibility occurs exclusively through the Preview Renewal API.
Request
The flexDiscountCodes parameter indicates the flexible discounts applicable for the subscription.
{
"autoRenewal": {
"enabled": true, // If Auto Renew is OFF, it must be turned ON to apply Discount Code. If it is already ON, this field is OPTIONAL.
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
}
}
Response
{
"subscriptionId": "8675309",
"currentQuantity": 10,
"usedQuantity": 2,
"offerId": "65304470CA01012",
"autoRenewal": {
"enabled": true,
"renewalQuantity": 5,
"flexDiscountCodes": ["ABCD-XV54-HG34-78YT"]
},
"renewalDate": "2020-05-20",
"creationDate": "2019-05-20T22:49:55Z",
"deploymentId": "12345",
"currencyCode": "USD",
"status": "1000",
"links": {
"self": {}
}
}
Remove a flexible discount from a subscription
Use the PATCH /v3/customers/<customer-id>/subscriptions/<subscription-id> with the query parameter reset-flex-discount-codes=true to remove a flexible discount from a subscription.
Request
- Request URL:
PATCH /v3/customers/<customer-id>/subscriptions/<subscription-id>?reset-flex-discount-codes=true - Request body: Empty or applicable body for update subscription
Sample empty request body:
{}
Response
{
"subscriptionId": "8675309",
"currentQuantity": 10,
"usedQuantity": 2,
"offerId": "65304470CA01012",
"autoRenewal": {
"enabled": true,
"renewalQuantity": 5
},
"renewalDate": "2020-05-20",
"creationDate": "2019-05-20T22:49:55Z",
"deploymentId": "12345",
"currencyCode": "USD",
"status": "1000",
"links": {
"self": {}
}
}