Skip to main content
POST
Error

Autorizações

Authorization
string
header
obrigatório

A staff session token, uk_st_…. Minted by sign-up, sign-in or the two-factor exchange. Only a 401 means it is spent; not_a_member (403) is about the organization named in X-Organization-Id and leaves the token good for the others.

Cabeçalhos

X-Organization-Id
string

The organization the caller is acting on — the org_… code that appears in the panel URL. It identifies; the membership JOIN is what authorizes, so a forged code reads nothing: the answer is not_a_member (403), which does not mean the session is over. Absent, the session's default organization answers, or — if that membership was revoked while the session was open — any other one the caller still holds.

Parâmetros de consulta

environment
enum<string>
padrão:live

Which environment to act in. A view parameter, valid only on the staff surface — a machine credential never chooses its environment, it is resolved from the key.

Opções disponíveis:
live,
test

Corpo

application/json

A coupon on the way in. Every field is stated — there is no PATCH on a coupon, so no request carrying this is editing one. The kind decides which fields carry the discount, and the other kind's fields are refused rather than ignored: a request naming both is naming two discounts.

name
string
obrigatório

What the payer sees beside the discount.

kind
enum<string>
obrigatório
Opções disponíveis:
percent,
amount
duration
enum<string>
obrigatório
Opções disponíveis:
once,
repeating,
forever
percent_off
integer

Required on percent, refused on amount. A whole number — the weakest gateway takes whole percents, and a catalogue storing 12.5 would promise what some checkout cannot honour.

Intervalo obrigatório: 1 <= x <= 100
amount_minor
integer<int64>

Required on amount with currency, refused on percent. An integer in the currency's minor unit; a discount of 0 discounts nothing and is refused.

Intervalo obrigatório: x >= 1
currency
string

ISO 4217, uppercase. Travels with amount_minor always — an amount without a currency is not money. At checkout, an amount coupon may only discount a price in this currency.

Exemplo:

"BRL"

duration_months
integer

Required on repeating, refused on the other durations — a stored number of months on a forever coupon is a second answer to a question the duration already answered.

Intervalo obrigatório: x >= 1
max_redemptions
integer

Omit for no cap. 0 is refused: a coupon nobody can redeem wearing a limit.

Intervalo obrigatório: x >= 1
expires_at
string<date-time>

When the offer stops being redeemable. Omit for never.

Resposta

The coupon. providers is empty — the gateway's own coupon is minted by the first checkout that applies it.

A discount you promise on your own catalogue. Its terms are immutable — a subscription bought under a coupon keeps producing invoices that only make sense against the terms as they were — so there is no update: a different discount is a new coupon, and this one is withdrawn by archiving.

The fields of the other kind and the other durations are null, never 0: 0% off and an amount of nothing are numbers a screen would render.

id
string<uuid>
name
string

What the payer sees beside the discount at the gateway's checkout.

kind
enum<string>
Opções disponíveis:
percent,
amount
percent_off
integer | null

A whole percentage, 1–100. null on an amount coupon.

amount_minor
integer<int64> | null

The amount off, an integer in the currency's minor unit. null on a percent coupon.

currency
string | null

ISO 4217, uppercase — the amount never travels without it. null on a percent coupon.

Exemplo:

"BRL"

currency_exponent
integer | null

How many decimal places the currency has, so amount_minor can be rendered without hard-coding a divisor. null on a percent coupon.

duration
enum<string>

How long the discount keeps applying to a recurring subscription: the first invoice, duration_months of them, or every one.

Opções disponíveis:
once,
repeating,
forever
duration_months
integer | null

How many invoices repeating covers. null on the other durations.

max_redemptions
integer | null

How many redemptions the offer is good for, across all customers. null is no cap.

expires_at
string<date-time> | null

When the offer stops being redeemable. null is never. Subscriptions already discounted keep their discount either way.

archived
boolean

Withdrawn: no new checkout may apply it. Existing discounts survive.

providers
object[]

How this coupon is known at each payment provider. Empty is the ordinary state — the gateway's coupon is minted by the first checkout that applies this one on each account.

created_at
string<date-time>