@bebapps/rapyd-sdk
Version:
An un-official [Rapyd](https://rapyd.net) SDK for Node.js.
62 lines (61 loc) • 2.55 kB
text/typescript
export interface Coupon {
/**
* Unique 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_**. Cannot contain spaces.
*/
id: `coupon_${string}`;
/**
* The 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. If the amount is a whole number, use an integer and not a decimal.
*/
amount_off: number;
/**
* When the coupon was created, in [*Unix time*](ref:glossary). Response only.
*/
created: number;
/**
* Three-letter ISO 4217 code for the currency used in the `amount_off` parameter. Uppercase.
*
* Required when `amount_off` is set.
*/
currency: string;
/**
* Indicates whether the coupon has been deleted.
*/
deleted: boolean;
/**
* Determines how long the discount remains in effect. One of the following:
* * **forever**
* * **once**
* * **repeating**
*/
duration: 'forever' | 'once' | 'repeating';
/**
* Determines the number of months that the coupon remains in effect after its creation. Integer. Relevant when `duration` is **repeating** and `redeem_by` is not set.
*/
duration_in_months: number;
/**
* Determines 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.
*/
max_redemptions: number;
/**
* A JSON object defined by the client.
*/
metadata: object;
/**
* Determines the size of the discount, measured in percent. Integer. Range: 1-100.
*/
percent_off: number;
/**
* The last time at which the coupon can be redeemed, in [*Unix time*](ref:glossary). After the `redeem_by` date, the coupon can no longer be applied to new customers. 'redeem_by' takes precedence over the setting of `duration_in_months`.
*/
redeem_by: number;
/**
* Indicates 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.
*/
times_redeemed: number;
/**
* Indicates whether the coupon can be redeemed.
*/
valid: boolean;
};