Skip to main content
POST
Create a promotion code

Authorizations

Authorization
string
header
default:easner_sk_test_…
required

A secret key, easner_sk_test_… or easner_sk_live_…, as Authorization: Bearer. Each key has one business, one mode and fixed scopes. Transfer routes also accept a transfer's easner_ta_… secret for the customer.

Headers

Idempotency-Key
string

Up to 255 characters. Keys are scoped to your business and mode. Longer is 400 invalid_idempotency_key. Honoured only on the operations marked idempotent.

Maximum string length: 255

Body

application/json
code
string
required

3 to 40 letters, numbers, dashes or underscores. Stored in capitals.

percent_off
number

Send this or amount_off.

Required range: x <= 100
amount_off
integer

Whole cents. Send with currency. Send this or percent_off.

Required range: x >= 1
currency
string

Required with amount_off.

Pattern: ^[A-Za-z]{3}$
duration
enum<string>
default:once
Available options:
once,
forever,
repeating
duration_in_months
integer

Repeating codes only.

Required range: 1 <= x <= 36
max_redemptions
integer
Required range: x >= 1
expires_at
string<date-time>

Must be in the future.

active
boolean
default:true

Response

The code made by an earlier call with the same Idempotency-Key.

object
any
required
id
string<uuid>
required
livemode
boolean
required
code
string
required
active
boolean
required

On and not archived. Expiry and the redemption limit are checked at payment time.

archived
boolean
required
percent_off
number | null
required
amount_off
integer | null
required
currency
string | null
required
duration
enum<string>
required
Available options:
once,
forever,
repeating
duration_in_months
integer | null
required
max_redemptions
integer | null
required
times_redeemed
integer
required
expires_at
string<date-time> | null
required
created
string<date-time>
required