curl --request POST \
--url https://api.withflex.com/v1/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"coupon": {
"name": "Coupon",
"applies_to": {
"products": [
"<string>"
]
},
"amount_off": 100,
"duration": "<unknown>",
"duration_in_months": null,
"percent_off": 10,
"max_redemptions": 100,
"metadata": {
"key": "value"
}
}
}
'{
"coupon": {
"coupon_id": "fcoup_1234567890",
"duration": "<unknown>",
"name": "<string>",
"valid": true,
"created_at": "<string>",
"test_mode": true,
"amount_off": 123,
"applies_to": {
"products": [
"<string>"
]
},
"duration_in_months": 123,
"metadata": {},
"percent_off": 123,
"max_redemptions": 123,
"times_redeemed": 123
}
}Create a coupon
curl --request POST \
--url https://api.withflex.com/v1/coupons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"coupon": {
"name": "Coupon",
"applies_to": {
"products": [
"<string>"
]
},
"amount_off": 100,
"duration": "<unknown>",
"duration_in_months": null,
"percent_off": 10,
"max_redemptions": 100,
"metadata": {
"key": "value"
}
}
}
'{
"coupon": {
"coupon_id": "fcoup_1234567890",
"duration": "<unknown>",
"name": "<string>",
"valid": true,
"created_at": "<string>",
"test_mode": true,
"amount_off": 123,
"applies_to": {
"products": [
"<string>"
]
},
"duration_in_months": 123,
"metadata": {},
"percent_off": 123,
"max_redemptions": 123,
"times_redeemed": 123
}
}Use a Bearer token to access this API.
Show child attributes
"Coupon"
A positive integer representing the amount to subtract from an invoice total (required if percent_off is not passed).
100
Required only if duration is repeating, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
null
A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if amount_off is not passed).
10
A positive integer specifying the number of times the coupon can be redeemed before it’s no longer valid.
100
Metadata to attach to this coupon.
{ "key": "value" }A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to subscriptions and checkout sessions.
Show child attributes
Unique identifier for the object.
"fcoup_1234567890"
Name of the coupon displayed to customers.
Taking account of the above properties, whether this coupon can still be applied to a customer.
Date were this coupon was created.
Whether the coupon is in test mode
Amount that will be taken off the subtotal of any invoices for this customer.
If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once.
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon.
Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
Number of times this coupon has been applied to a customer.