Before actually redeeming a coupon code, it's possible to test its validity and eligibility. The customer, plan, and subscription arguments are optional, but if they are not provided, the actual eligibility for the customer, plan, and subscription is not tested.
The customer argument must always be provided together with either the plan or the subscription argument, or both, in order to check the coupon's validity against its redemption strategy.
For example, if a coupon's redemption strategy is 'once_per_plan,' both the customer and plan must be provided to validate the coupon using the 'once per plan' strategy. If the strategy is 'once_per_subscription,' both the customer and subscription must be provided to validate the coupon using the 'once per subscription' strategy. If the strategy is 'once_per_customer,' only the customer needs to be provided to validate the coupon using the 'once per customer' strategy. Otherwise, only the basic checks are performed.
The arguments needs to be provided as query parameters.
Errors
The operation can generate the following errors beside the generic HTTP error codes described here.
Error code | HTTP code | Description |
---|---|---|
86 | 404 | Coupon code not found or coupon not eligible for use |
87 | 400 | Coupon already used by customer. Can only be returned if customer argument is given. |
9 | 404 | Customer for provided customer handle cannot be found |