Skip to main content
POST
/
api
/
v1
/
coupons
JavaScript
import Stigg from '@stigg/typescript';

const client = new Stigg({
  apiKey: process.env['STIGG_API_KEY'], // This is the default and can be omitted
});

const coupon = await client.v1.coupons.create({
  id: 'id',
  amountsOff: [{ amount: 0, currency: 'usd' }],
  description: 'description',
  durationInMonths: 1,
  name: 'name',
  percentOff: 1,
});

console.log(coupon.data);
{
  "data": {
    "id": "<string>",
    "name": "<string>",
    "description": "<string>",
    "type": "FIXED",
    "status": "ACTIVE",
    "source": "STIGG",
    "percentOff": 123,
    "amountsOff": [
      {
        "amount": 123,
        "currency": "usd"
      }
    ],
    "billingId": "<string>",
    "billingLinkUrl": "<string>",
    "durationInMonths": 123,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Authorizations

X-API-KEY
string
header
required

Server API Key

Headers

X-API-KEY
string
required

API Key

Body

application/json

Create a coupon with percentage or fixed-amount discount.

id
string
required

The unique identifier for the entity

Maximum string length: 255
name
string
required

Name of the coupon

Maximum string length: 40
description
string | null
required

Description of the coupon

Maximum string length: 255
percentOff
number | null
required

Percentage discount off the original price

Required range: 1 <= x <= 100
amountsOff
Money · object[] | null
required

Fixed amount discounts in different currencies

Minimum array length: 1
durationInMonths
integer | null
required

Duration of the coupon validity in months

Required range: x >= 1
additionalMetaData
any | null

Metadata associated with the entity

Response

Coupon created.

Response object

data
Coupon · object
required

Discount instrument with percentage or fixed amount