Backend API
Create a new coupon code.
Arguments
parent_idobjectIdrequired
ID of the parent coupon.
idobjectId
ID of the coupon code.
codestring
Unique code to identify the coupon.
date_createddateauto
Date and time the coupon code was created.
date_updateddateauto
Date and time the coupon code was last updated.
gen_idobjectId
The ID of the generation instance for a particular coupon code.
ordersOrder
parentCoupon
Expandable link to the parent coupon.
subscriptionsSubscription
use_countint
use_totalint
POST/coupons:codes
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.post('/coupons:codes', {
code: 'ALCHEMY25',
parent_id: '62cc86897ad4f100132c953d'
});The coupon code model
{
"gen_id": "62b5cdffd7ad010018c66249",
"parent_id": "62b5cdff2e40ab001ac27240",
"use_count": 0,
"date_created": "2022-06-24T14:45:20.941Z",
"use_total": 0,
"code": "PNB83100017",
"id": "62b5ce0079c5d80012fe5f65"
}