Coupons and promotion codes. A coupon defines the discount; a promotion code is a customer-facing code that redeems it. Apply either to subscriptions, invoices, and Checkout with discounts: [{coupon}] or [{promotion_code}]. See https://docs.stripe.com/api/coupons and https://docs.stripe.com/api/promotion_codes.
Functions
create-coupon
fn (request: CreateCouponRequest): Map
fn (request: CreateCouponRequest, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/coupons - Create a coupon. Give percent_off, or amount_off with currency. duration is "once" (default), "repeating" (with duration_in_months), or "forever".
Example
::coupons ::stripe::coupons
coupon ::coupons/create-coupon(::coupons/CreateCouponRequest({
percent_off: 25.0,
duration: "repeating",
duration_in_months: 3,
name: "Launch 25%"
}))
code ::coupons/create-promotion-code(::coupons/CreatePromotionCodeRequest({
promotion: {type: "coupon", coupon: coupon.id},
code: "LAUNCH25"
}))
create-promotion-code
fn (request: CreatePromotionCodeRequest): Map
fn (request: CreatePromotionCodeRequest, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/promotion_codes - Create a customer-facing code for a coupon.
promotion is {type: "coupon", coupon: "..."} (it replaced the
top-level coupon parameter in 2025-09-30.clover). Omit code to have
Stripe generate one. restrictions can require first_time_transaction
or a minimum_amount.
Example
::coupons ::stripe::coupons
promo ::coupons/create-promotion-code(::coupons/CreatePromotionCodeRequest({
promotion: {type: "coupon", coupon: "SUMMER25"},
code: "SUMMER25OFF",
restrictions: {first_time_transaction: true}
}))
promo.id
delete-coupon
fn (coupon: Str): Map
fn (coupon: Str, opts: Map): Map
DELETE /v1/coupons/{coupon} - Delete a coupon so it can't be redeemed again. Existing discounts that use it are unaffected.
Example
::coupons ::stripe::coupons
result ::coupons/delete-coupon("SUMMER25")
result.deleted
get-coupon
fn (coupon: Str): Map
fn (coupon: Str, opts: Map): Map
GET /v1/coupons/{coupon} - Retrieve a coupon by ID.
Example
::coupons ::stripe::coupons
coupon ::coupons/get-coupon("SUMMER25")
coupon.valid
get-promotion-code
fn (promotion-code: Str): Map
fn (promotion-code: Str, opts: Map): Map
GET /v1/promotion_codes/{promotion_code} - Retrieve a promotion code by
ID (promo_...). To look one up by its customer-facing code, use
list-promotion-codes({code: "LAUNCH25"}).
Example
::coupons ::stripe::coupons
promo ::coupons/get-promotion-code("promo_123")
promo.active
list-coupons
fn (): Map
fn (params: Map): Map
fn (params: Map, opts: Map): Map
GET /v1/coupons - List coupons. Optional params: created, limit,
starting_after, ending_before.
Example
::coupons ::stripe::coupons
page ::coupons/list-coupons({limit: 20})
names map(page.data, %.name)
list-promotion-codes
fn (): Map
fn (request: ListPromotionCodesRequest): Map
fn (request: ListPromotionCodesRequest, opts: Map): Map
GET /v1/promotion_codes - List promotion codes. Filter by code
(case-insensitive), coupon, customer, or active.
Example
::coupons ::stripe::coupons
page ::coupons/list-promotion-codes(::coupons/ListPromotionCodesRequest({code: "SUMMER25OFF", active: true}))
promo-id page.data[0].id
update-coupon
fn (coupon: Str, request: UpdateCouponRequest): Map
fn (coupon: Str, request: UpdateCouponRequest, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/coupons/{coupon} - Update a coupon's name, metadata, or
currency_options. Discount terms are immutable.
Example
::coupons ::stripe::coupons
::coupons/update-coupon("SUMMER25", ::coupons/UpdateCouponRequest({
name: "Summer sale",
metadata: {campaign: "2026-summer"}
}))
update-promotion-code
fn (promotion-code: Str, request: UpdatePromotionCodeRequest): Map
fn (promotion-code: Str, request: UpdatePromotionCodeRequest, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/promotion_codes/{promotion_code} - Update a promotion code. Set
active: false to stop redemptions.
Example
::coupons ::stripe::coupons
::coupons/update-promotion-code("promo_123", ::coupons/UpdatePromotionCodeRequest({active: false}))
Types
CreateCouponRequest
CreateCouponRequest type {
id: Str?,
name: Str?,
percent_off: Dec?,
amount_off: Int?,
currency: Str?,
currency_options: Map?,
duration: Str?,
duration_in_months: Int?,
max_redemptions: Int?,
redeem_by: Int?,
applies_to: Map?,
metadata: Map?,
expand: Vec<Str>?
}
CreatePromotionCodeRequest
CreatePromotionCodeRequest type {
promotion: Map,
code: Str?,
active: Bool?,
customer: Str?,
expires_at: Int?,
max_redemptions: Int?,
restrictions: Map?,
metadata: Map?,
expand: Vec<Str>?
}
ListPromotionCodesRequest
ListPromotionCodesRequest type {
code: Str?,
coupon: Str?,
customer: Str?,
active: Bool?,
created: Any?,
limit: Int?,
starting_after: Str?,
ending_before: Str?,
expand: Vec<Str>?
}
UpdateCouponRequest
UpdateCouponRequest type {
name: Str?,
metadata: Map?,
currency_options: Map?,
expand: Vec<Str>?
}
UpdatePromotionCodeRequest
UpdatePromotionCodeRequest type {
active: Bool?,
restrictions: Map?,
metadata: Map?,
expand: Vec<Str>?
}