PromotionCodes
Returns the promotion codes in Stripe and supports creating and updating them.
Table-Specific Information
SELECT
The driver uses the Stripe API to filter the results by the following columns and operators:
| Column | Supported Operators |
| Id | = |
| Active | = |
| Code | = |
| CouponId | = |
| Created | =, >, >=, <, <= |
| Customer | = |
| AccountId | = |
The rest of the filter is executed client-side within the driver.
You can select from the PromotionCodes table with the following queries:
SELECT * FROM PromotionCodes
SELECT * FROM PromotionCodes WHERE Id = '123124'
INSERT
To create a promotion code, the CouponId is required:
INSERT INTO PromotionCodes (Active, Code, CouponId, Customer, MaxRedemptions) VALUES ('true', 'FIRST5', 'WN3VpE01', 'cus_NBs3z63zmfCJy1', 4)
INSERT INTO PromotionCodes (Code, Active, Customer, CouponId, Metadata, Expiresat, MaxRedemptions, RestrictionsFirstTimeTransaction, RestrictionsMinimumAmount, RestrictionsMinimumAmountCurrency) VALUES ('TestCode', true, 'cus_PE90A5xYP8TpeM', 'WG4hYi8e', '[{"A":"BCD","E":"FGH","I":"JKL"}]', '2023-12-30 12:40:20', 15, true, 25, 'eur')
UPDATE
To modify a promotion code, specify the code's Id:
UPDATE PromotionCodes SET Active = 'false' WHERE Id = '123124'
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | String | True |
The Id of the promotion code. | |
| Active | Boolean | False |
Indicates whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. | |
| Code | String | False |
The customer-facing code. | |
| CouponAmountOff | Integer | True |
The amount (in the currency specified) that is taken off the subtotal of any invoices for this customer. | |
| CouponCreated | Datetime | True |
The date and time at which the coupon was created, measured in seconds since the Unix epoch. | |
| CouponCurrency | String | True |
If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. | |
| CouponDuration | String | True |
One of forever, once, and repeating. | |
| CouponDurationInMonths | Integer | True |
If duration is repeating, the number of months the coupon applies. The value is Null if coupon duration is forever or once. | |
| CouponId | String | False |
The Id of the coupon. | |
| CouponLivemode | Boolean | True |
Indicates whether the object exists in live mode. The value is true in live mode and false in test mode. | |
| CouponMaxRedemptions | Integer | True |
The maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. | |
| CouponMetadata | String | True |
The set of key-value pairs that you can attach to a coupon. | |
| CouponName | String | True |
Name of the coupon displayed to customers. | |
| CouponPercentOff | Double | True |
The percent to be taken off the subtotal of any invoices for this customer for the duration of the coupon. | |
| CouponRedeemBy | Datetime | True |
The date after which the coupon can no longer be redeemed. | |
| CouponTimesRedeemed | Integer | True |
The number of times this coupon has been applied to a customer. | |
| CouponAppliesToProducts | Integer | True |
Contains information about what this coupon applies to. A list of product Ids this coupon applies to. | |
| CouponValid | Boolean | True |
Indicates whether this coupon can still be applied to a customer, taking the above properties into account. | |
| Created | Datetime | True |
The date and time at which the object was created, measured in seconds since the Unix epoch. | |
| Customer | String | False |
The customer that this promotion code can be used by. | |
| ExpiresAt | Datetime | False |
The date at which the promotion code can no longer be redeemed. | |
| Livemode | Boolean | True |
Indicates whether the object exists in live mode. The value is true in live mode and false in test mode. | |
| MaxRedemptions | Integer | False |
The maximum number of times this promotion code can be redeemed. | |
| Metadata | String | False |
The set of key-value pairs that you can attach to a value list object. | |
| RestrictionsCurrencyOptions | String | True |
Promotion codes defined in each available currency option. Each key must be a three-letter ISO currency code and a supported currency. | |
| RestrictionsFirstTimeTransaction | Boolean | False |
A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices. | |
| RestrictionsMinimumAmount | Integer | False |
The minimum amount required to redeem this Promotion Code into a Coupon. | |
| RestrictionsMinimumAmountCurrency | String | False |
A three-letter ISO code for minimum_amount. | |
| TimesRedeemed | Integer | True |
The number of times this promotion code has been used. |
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 |
| AccountId | String |
The Id of the connected account to get promotion code for. |