Apply a promotion to a subscription contract using a promotion code
  • 22 Nov 2024
  • 4 Minutes to read
  • Contributors
  • Dark
    Light

Apply a promotion to a subscription contract using a promotion code

  • Dark
    Light

Article summary

Post
/promotion/v1/promotion-codes/_apply

Apply a promotion to a subscription contract using the promotion code.

Security
HTTP
Type bearer
Body parameters
Expand All
object
subscriptionContract
object Required

The request data of a subscription contract for the promotion validation.

createdAt
string | null Required

The date and time the subscription contract was created. When it's null, means it's a new subscription contract

subscriptionTypeId
string Required

The subscription type ID of the subscription contract.

discounts
Array of object

A list of discount codes applied to the subscription contract.

Example[ { "code": "100OFF", "terminationCriteria": { "orderOrdinal": 3 } } ]
object
code
string Required

The discount code to apply to the subscription contract.

terminationCriteria
object

The order ordinal beyond which the discount code will no longer be applied.

orderOrdinal
integer Required
addedAt
string

The date and time the discount code was added.

promotionCode
string Required

The promotion code to apply.

Min length1
Responses
200

Promotion that has been applied

Expand All
object
data
object
id
string

A unique ID representing the promotion.

Min length1
type
string

The type of the resource

Valid values[ "PROMOTION" ]
createdAt
string (date)

The date and time the promotion was created.

updatedAt
string (date)

The date and time the promotion was last updated.

enabled
boolean

Whether the promotion is enabled to consume. If disabled, new customers will not be able to apply the promotion code, but existing customers with it already applied will be unaffected.

name
string

The name of the promotion.

Min length1
description
string

A detailed description of the promotion.

Min length1
code
string

The unique code to redeem the promotion.

constraint
object

The constraint to determine whether a promotion can be redeemed, including the dates to run for, usage counts, and whether it's only for new customers.

promoStartAt
string (date)

The date and time the promotion starts (inclusive). A promotion must be within these dates for a customer to be able to apply its code.

promoEndAt
string (date)

The date and time the promotion ends (inclusive). A promotion must be within these dates for a customer to be able to apply its code.

maxUsage
number

The maximum number of times the promotion can be redeemed (across all customers).

Minimum1
usageCount
number

The number of times the promotion has been redeemed (across all customers).

Minimum0
subscription
object
newOnly
boolean

Whether the promotion is only for new subscriptions.

typeIds
Array of string

The subscription type IDs the promotion is valid for.

string
Min length1
rules
Array of object

The rules of what orders should receive the promotion effect (such as a monetary discount).

object
effect
object

The effect of the promotion, detailing the percentage or monetary amount to discount.

effectType
string

The type of the effect.

Valid values[ "PERCENTAGE_DISCOUNT", "AMOUNT_DISCOUNT" ]
amount
string

The amount value of the effect.

conditions
Array of object

The conditions to determine if an order should receive the specified effect (such as a percentage discount).

object
conditionType
string

The type of the condition. ORDER_NUMBER_AFTER_APPLIED: The order number as counted from the day the promotion is applied. SUBSCRIPTION_CONTRACT_ORDER_NUMBER: the order number as counted from the start of the subscription contract.

Valid values[ "ORDER_NUMBER_AFTER_APPLIED", "SUBSCRIPTION_CONTRACT_ORDER_NUMBER" ]
value
string

The value of the condition. For ORDER_NUMBER_AFTER_APPLIED, this is the order number counting from the day the promotion is applied. For SUBSCRIPTION_CONTRACT_ORDER_NUMBER, this is the order number of the subscription contract.

meta
object

The metadata of the promotion.

property*
meta
object

Additional information about the resource.

property*
401

Unauthorized

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

403

Forbidden

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

404

Not Found

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

422

Unprocessable Content

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

429

Too Many Requests

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

500

Internal Server Error

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.

503

Service Unavailable

Expand All
object
errors
Array of object

Details of problems encountered processing the request.

object

Details of a problem encountered processing the request.

status
string

The HTTP status code applicable to the problem

title
string

A short-human readable description of the problem, this should not change from occurrence to occurrence.

detail
string

A human-readable explanation specific to this occurrence of the problem.


Was this article helpful?

What's Next