Skip to main content

Coupon

The coupon can be applied to the following objects - _ Subscription - All charges in the subscription are subject to the discount described in the coupon. To add a coupon to a subscription, first use Create Coupon. Then add the coupon ID to the coupon field of the subscription with Create Subscription or Update Subscription. _ Customer - The discount applies to all charges to the customer. To add a coupon to a customer, first use Create Coupon. Then add the coupon ID to the coupon field of the customer with Create Customer or Update Customer. * Order - The discount applies to a single order. To add a coupon to an order, first use Create Coupon. The duration field of the coupon must be set to repeating, and the duration_in_months and discount_duration_in_uses fields must be set to 1. Then add the coupon ID to the coupon field of the order with Create an Order or Update Order. A coupon can be applied to one or more customers or subscriptions. However, a subscription can have only one coupon, and the only way to assign two or more coupons to a customer is to assign them to separate subscriptions. If there is a coupon for the customer and another coupon for the customer's subscription, the subscription coupon takes precedence.

Properties

NameTypeRequiredDescription
amount_offfloatThe amount of money to subtract from the payment. Decimal. Range: Positive decimal number, including the correct number of decimal places for the currency exponent, as defined in ISO 2417:2015.
createdfloatWhen the coupon was created, in Unix time. Response only.
currencystr
descriptionstrDescription of the coupon.
discount_duration_in_usesfloatThe number of times that the coupon can be redeemed by a specific customer or subscription. Relevant when duration is repeating and redeem_by is not set.
discount_valid_untilfloatThe final date that a discount can be used, in Unix time. Relevant when discount_validity_in_months is not set.
discount_validity_in_monthsfloatThe number of months after the discount is created that it can be used. Relevant when discount_valid_until is not set.
durationDurationDetermines how long the discount remains in effect. One of the following: _ forever _ repeating
duration_in_monthsfloatDetermines the number of months that the coupon remains in effect after its creation. Integer. Required when duration is repeating.
id_strUnique ID for this coupon. English alphanumeric characters with no special characters except underscore. If the merchant does not define an ID, Rapyd generates a string starting with coupon_.
max_redemptionsfloatDetermines the number of times the coupon can be redeemed. The number of customers, subscriptions or orders that the coupon is applied to cannot exceed this number. Integer.
metadatadictA JSON object defined by the client.
percent_offfloatDetermines the size of the discount, measured in percent. Integer. Range: 1-100.
redeem_byfloatThe last time at which the coupon can be redeemed, in Unix time. After the redeem_by date, the coupon can no longer be applied to new customers. 'redeem_by' takes precedence over the setting of discount_duration_in_uses and duration_in_months.
times_redeemedfloatIndicates the number of times the coupon has been applied to a customer, subscription or invoice. If the discount has been used more than one time by a customer, subscription or invoice, the number of redemptions after the first is also added to this value. Integer. When this value equals max_redemptions, the coupon becomes no longer valid. Response only.
validboolIndicates whether the coupon can be redeemed.

Duration

Determines how long the discount remains in effect. One of the following: _ forever _ repeating

Properties

NameTypeRequiredDescription
FOREVERstr"forever"
REPEATINGstr"repeating"

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →