Skip to main content
POST
Create Coupon

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Scopes

Headers

Idempotency-Key
string

The idempotency key that will be used to ensure the request is only performed once

Path Parameters

company_id
string
required

The company ID with the prefix 'cmp_'.

Body

application/json
name
string
required

The name of the coupon. This will show up in invoices

promo_code
string
required

The first promo code to create for the coupon. The coupon must be ACTIVE. If the promo code cannot be created, the coupon is not created either

state
string
required

The state of the coupon that can be one of ACTIVE, PENDING, REVOKED, EXPIRED or CONSUMED

type
string
required

The type of the coupon: DISCOUNT_AMOUNT_COUPON, DISCOUNT_PERCENT_COUPON, CREDIT_AMOUNT_COUPON or CREDIT_UNITS_COUPON

amount
object | null

The amount of the coupon, for DISCOUNT_AMOUNT_COUPON and CREDIT_AMOUNT_COUPON types

applies_to_products
string[] | null

Product IDs the coupon is restricted to. If empty, the coupon applies to all products

cap
object | null

The maximum discount amount a percent coupon can apply

duration
string

How long the coupon applies once redeemed, for example FOREVER or MONTHS

expiration_date
null | string<date-time>

The expiration date for the coupon in RFC-3339 format

item_id
null | string

The billable item ID for the CREDIT_UNITS_COUPON type

item_pricing_id
null | string

The billable item pricing ID the coupon is restricted to

max_redemptions
integer

The maximum number of times the coupon can be redeemed

Required range: x >= 0
metadata
object

Arbitrary key-value metadata to store with the coupon

months
integer

The number of months the coupon applies for, when duration is MONTHS

Required range: x >= 0
percent
number<double>

The discount as a fraction between 0 and 1, for the DISCOUNT_PERCENT_COUPON type

product_pricing_id
null | string

The product pricing ID the coupon is restricted to

units
number<double>

The number of units, for the CREDIT_UNITS_COUPON type

Response

201 - application/json

Created

amount
object | null

The amount which has value in cents and a currency

cap
object | null

The amount which has value in cents and a currency

created_at
string<date-time>
duration
string
expiration_date
null | string<date-time>
id
string
import_created_at_ref
null | string<date-time>
import_ref
null | string
imported_from
null | string
item
object
item_id
null | string
item_pricing
object
item_pricing_id
null | string
max_redemptions
integer
Required range: x >= 0
metadata
object
months
integer
Required range: x >= 0
name
string
num_redemptions
integer
Required range: x >= 0
percent
number<double>
product_pricing
object
product_pricing_id
null | string
products
string[] | null
promo_codes
object[] | null
state
string
type
string
units
number<double>