Passer au contenu principal
POST
/
v1
/
coupons
Create coupon
curl --request POST \
  --url https://api.hyperline.co/v1/coupons \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Partner discount",
  "type": "amount",
  "discount_amount": 2000,
  "currency": "EUR",
  "description": null,
  "expiration_date": null,
  "redemption_limit": null,
  "product_ids": null,
  "repeat": "duration",
  "duration": {
    "count": 3,
    "period": "months"
  }
}
'
{
  "id": "cou_DKL4Xcb5VSa8CQ",
  "name": "Partner discount",
  "description": null,
  "expiration_date": null,
  "redemption_limit": null,
  "product_ids": [
    "itm_DKL4Xcb5VSa8CQ",
    "itm_1234567890abcdef"
  ],
  "repeat": "duration",
  "duration": {
    "count": 3,
    "period": "months"
  },
  "created_at": "2024-12-20T16:04:11Z",
  "type": "amount",
  "discount_amount": 2000,
  "currency": "EUR"
}

Autorisations

Authorization
string
header
requis

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

Corps

application/json

Create coupon payload

name
string
requis

Coupon name.

Exemple:

"Partner discount"

type
enum<string>
requis
Options disponibles:
amount
discount_amount
number
requis

Amount to apply as a discount on the total amount (excluding taxes) of a subscription. Expressed in the currency's smallest unit.

Exemple:

2000

currency
enum<string>
requis

Currency code. See ISO 4217.

Options disponibles:
EUR,
AED,
AFN,
XCD,
ALL,
AMD,
AOA,
ARS,
USD,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
XOF,
BMD,
BND,
BOB,
BRL,
BSD,
BTN,
NOK,
BWP,
BYR,
BZD,
CAD,
CDF,
XAF,
CHF,
NZD,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
ANG,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
MAD,
ERN,
ETB,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
IRR,
ISK,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KPW,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRO,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
XPF,
NGN,
NIO,
NPR,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SDG,
SEK,
SGD,
SHP,
SLL,
SOS,
SRD,
SSP,
STD,
SYP,
SZL,
THB,
TJS,
TMT,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
UYU,
UZS,
VEF,
VND,
VUV,
WST,
YER,
ZAR,
ZMW,
ZWL
Exemple:

"EUR"

description
string | null

Coupon description.

Exemple:

null

expiration_date
string<date-time> | null

Date corresponding to the expiration of the coupon.

Exemple:

null

redemption_limit
number | null

Maximum number of subscriptions to which a single coupon can be applied.

Exemple:

null

product_ids
string[] | null

List of product IDs the coupon can be applied to. If empty, the coupon can be applied to any product.

Exemple:

null

repeat
enum<string> | null

Default repeat behaviour applied when the coupon is attached to a subscription. Valid values: once, forever, duration. Can be overridden at attach time.

Options disponibles:
once,
forever,
duration
Exemple:

"duration"

duration
object

Default duration applied when repeat is duration. Required when repeat is duration, must be null otherwise.

Exemple:
{ "count": 3, "period": "months" }

Réponse

201 - application/json

The newly created coupon

id
string
requis

Coupon ID.

Exemple:

"cou_DKL4Xcb5VSa8CQ"

name
string
requis

Coupon name.

Exemple:

"Partner discount"

description
string | null
requis

Coupon description.

Exemple:

null

expiration_date
string<date-time> | null
requis

Date corresponding to the expiration of the coupon.

Exemple:

null

redemption_limit
number | null
requis

Maximum number of subscriptions to which a single coupon can be applied.

Exemple:

null

product_ids
string[]
requis

List of product IDs the coupon can be applied to. If empty, the coupon can be applied to any product.

Exemple:
[
"itm_DKL4Xcb5VSa8CQ",
"itm_1234567890abcdef"
]
repeat
enum<string> | null
requis

Default repeat behaviour applied when the coupon is attached to a subscription. Valid values: once, forever, duration. Can be overridden at attach time.

Options disponibles:
once,
forever,
custom,
duration
Exemple:

"duration"

duration
object
requis

Default duration applied when repeat is duration. Required when repeat is duration, must be null otherwise.

Exemple:
{ "count": 3, "period": "months" }
created_at
string<date-time>
requis

UTC date time string in the ISO 8601 format.

Exemple:

"2024-12-20T16:04:11Z"

type
enum<string>
requis
Options disponibles:
amount
discount_amount
number
requis

Amount to apply as a discount on the total amount (excluding taxes) of a subscription. Expressed in the currency's smallest unit.

Exemple:

2000

currency
enum<string> | null
requis

Currency code. See ISO 4217.

Options disponibles:
EUR,
AED,
AFN,
XCD,
ALL,
AMD,
AOA,
ARS,
USD,
AUD,
AWG,
AZN,
BAM,
BBD,
BDT,
BGN,
BHD,
BIF,
XOF,
BMD,
BND,
BOB,
BRL,
BSD,
BTN,
NOK,
BWP,
BYR,
BZD,
CAD,
CDF,
XAF,
CHF,
NZD,
CLP,
CNY,
COP,
CRC,
CUP,
CVE,
ANG,
CZK,
DJF,
DKK,
DOP,
DZD,
EGP,
MAD,
ERN,
ETB,
FJD,
FKP,
GBP,
GEL,
GHS,
GIP,
GMD,
GNF,
GTQ,
GYD,
HKD,
HNL,
HRK,
HTG,
HUF,
IDR,
ILS,
INR,
IQD,
IRR,
ISK,
JMD,
JOD,
JPY,
KES,
KGS,
KHR,
KMF,
KPW,
KRW,
KWD,
KYD,
KZT,
LAK,
LBP,
LKR,
LRD,
LSL,
LYD,
MDL,
MGA,
MKD,
MMK,
MNT,
MOP,
MRO,
MUR,
MVR,
MWK,
MXN,
MYR,
MZN,
NAD,
XPF,
NGN,
NIO,
NPR,
OMR,
PAB,
PEN,
PGK,
PHP,
PKR,
PLN,
PYG,
QAR,
RON,
RSD,
RUB,
RWF,
SAR,
SBD,
SCR,
SDG,
SEK,
SGD,
SHP,
SLL,
SOS,
SRD,
SSP,
STD,
SYP,
SZL,
THB,
TJS,
TMT,
TND,
TOP,
TRY,
TTD,
TWD,
TZS,
UAH,
UGX,
UYU,
UZS,
VEF,
VND,
VUV,
WST,
YER,
ZAR,
ZMW,
ZWL
Exemple:

"EUR"