Coupons
Represents coupons that apply discounts to customers, including discount amount, duration, redemption limits, and applicability details.
Table-Specific Information
SELECT
The add-in uses the Stripe API to filter the results by the following columns and operators while the rest of the filter is executed client-side within the add-in.
| Column | Supported Operators |
| Id | = |
| CreatedAt | =, >, >=, <, <= |
| AccountId | = |
You can select a specific coupon by specifying its Id:
SELECT * FROM Coupons WHERE Id = 'nReumrk6'
INSERT
To create a new coupon, at least Duration is required. If Duration is set to repeating, DurationInMonths is also required:
INSERT INTO Coupons (Id, Duration, DurationInMonths, PercentOff, Currency) VALUES ('12345678', 'repeating', '12', '50', 'ALL')
UPDATE
To modify a credit note, specify its Id:
Update Coupons SET Name = 'non-repeating' WHERE Id = 'mIKfjEfL'
DELETE
To delete a coupon, specify the Id field:
DELETE FROM Coupons WHERE Id = 'nReumrk6'
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | String | False |
The Id of the coupon. | |
| CreatedAt | Datetime | True |
The date on which the coupon was created. | |
| Currency | String | False |
If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. | |
| Duration | String | False |
Specifies how long a customer who applies this coupon receives the discount, one of forever, once, or repeating. | |
| DurationInMonths | Integer | False |
The number of months the coupon applies when duration is repeating. This value is null if the coupon duration is forever or once. | |
| AmountOff | Integer | False |
The amount, in the currency specified, that is taken off the subtotal of any invoices for this customer. | |
| PercentOff | Decimal | False |
The percent that is taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with a percent_off of 50 makes a $100 invoice $50 instead. | |
| Valid | Boolean | True |
Indicates whether this coupon can still be applied to a customer, taking into account the other coupon properties. | |
| MaxRedemptions | Integer | False |
The maximum number of times this coupon can be redeemed, in total, before it is no longer valid. | |
| RedeemBy | Datetime | False |
The date after which the coupon can no longer be redeemed. | |
| MetadataAggregate | String | False |
The set of key/value pairs that you can attach to the coupon object. | |
| TimesRedeemed | Integer | True |
The number of times this coupon has been applied to a customer. | |
| Object | String | True |
The string representing the object's type. Objects of the same type share the same value. | |
| AppliesTo | String | False |
The information about what this coupon applies to. This field is not included by default. To include it in the response, expand the applies_to field. | |
| Livemode | Boolean | True |
Indicates whether the object exists in live mode. Returns true if the object exists in live mode and false if the object exists in test mode. | |
| Name | String | False |
The name of the coupon displayed to customers on, for instance, invoices or receipts. | |
| CurrencyOptionsAggregate | String | True |
The coupons defined in each available currency option. Each key is a three-letter ISO currency code. |
Pseudocolumns
Pseudocolumn fields are used in the WHERE clause of SELECT statements and offer more granular control over the data returned from the data source.
| Name | Type | Description |
| CurrencyOptions | String |
The coupons defined in each available currency option, only supported if amount_off is passed. Each key must be a three-letter ISO currency code and a supported currency. |
| AccountId | String |
The Id of the connected account to get coupons for. |