Coupons

Create and manage discount coupons.

Coupons API

The Coupons API allows you to create and manage discount codes for your payments.

The Coupon Object

{
  "id": "cpn_abc123def456",
  "object": "coupon",
  "code": "SAVE20",
  "percent_off": 20,
  "amount_off": null,
  "currency": "GHS",
  "duration": "once",
  "duration_in_months": null,
  "max_redemptions": 100,
  "max_redemptions_per_customer": 1,
  "times_redeemed": 5,
  "minimum_amount": null,
  "maximum_discount": null,
  "valid_from": "2024-01-01T00:00:00Z",
  "valid_until": "2024-12-31T23:59:59Z",
  "applies_to": "all",
  "first_time_only": false,
  "active": true,
  "metadata": {},
  "livemode": true,
  "created": "2024-01-01T10:00:00Z"
}

Attributes

AttributeTypeDescription
idstringUnique identifier
objectstringAlways "coupon"
codestringCoupon code (uppercase)
percent_offnumberPercentage discount (0-100)
amount_offnumberFixed amount discount in GHS
currencystringCurrency code
durationstringonce, repeating, forever
duration_in_monthsintegerDuration for repeating coupons
max_redemptionsintegerMaximum total redemptions
max_redemptions_per_customerintegerPer-customer redemption limit
times_redeemedintegerNumber of times redeemed
minimum_amountnumberMinimum order amount in GHS
maximum_discountnumberMaximum discount cap in GHS
valid_fromstringStart date
valid_untilstringExpiration date
applies_tostringWhat the coupon applies to
first_time_onlybooleanOnly for first-time customers
activebooleanWhether coupon is active
metadataobjectCustom metadata
createdstringCreation timestamp

Create a Coupon

POST /v1/coupons

Request Body

ParameterTypeRequiredDescription
codestringYesCoupon code (auto-uppercased)
percent_offnumberNo*Percentage discount (0-100)
amount_offnumberNo*Fixed amount discount in GHS
currencystringNoCurrency (default: GHS)
durationstringNoonce (default), repeating, forever
duration_in_monthsnumberNoDuration for repeating coupons
max_redemptionsnumberNoMaximum total redemptions
max_redemptions_per_customernumberNoPer-customer limit
minimum_amountnumberNoMinimum order amount in GHS
maximum_discountnumberNoMaximum discount cap in GHS
valid_fromstringNoStart date (ISO 8601)
valid_untilstringNoExpiration date (ISO 8601)
applies_tostringNoDefault: all
applicable_idsarrayNoArray of applicable product/invoice IDs
first_time_onlybooleanNoOnly for first-time customers (default: false)
metadataobjectNoCustom metadata

*Either percent_off or amount_off is required (not both).

curl -X POST https://api.shikacreators.com/v1/coupons \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "code": "SAVE20",
    "percent_off": 20,
    "duration": "once",
    "max_redemptions": 100,
    "valid_until": "2024-12-31T23:59:59Z"
  }'
const coupon = await shikacreators.coupons.create({
  code: 'SAVE20',
  percent_off: 20,
  duration: 'once',
  max_redemptions: 100,
  valid_until: '2024-12-31T23:59:59Z'
})
coupon = client.coupons.create(
    code='SAVE20',
    percent_off=20,
    duration='once',
    max_redemptions=100,
    valid_until='2024-12-31T23:59:59Z'
)

Retrieve a Coupon

GET /v1/coupons/:id

Get by Code

GET /v1/coupons/code/:code

Update a Coupon

POST /v1/coupons/:id

Request Body

ParameterTypeDescription
activebooleanEnable/disable coupon
max_redemptionsnumberUpdate redemption limit
valid_untilstringUpdate expiration date
metadataobjectUpdate metadata

Delete a Coupon

DELETE /v1/coupons/:id

Validate a Coupon

Validates a coupon code and calculates the discount.

POST /v1/coupons/validate

Request Body

ParameterTypeRequiredDescription
codestringYesCoupon code to validate
customerstringNoCustomer ID (for per-customer checks)
amountnumberNoOrder amount in GHS (for minimum amount checks)

Response

{
  "valid": true,
  "coupon": { ... },
  "discount": 20,
  "currency": "GHS"
}

If invalid:

{
  "valid": false,
  "reason": "Coupon has expired"
}

List Coupons

GET /v1/coupons

Query Parameters

ParameterTypeDescription
limitintegerNumber of results (1-100, default 10)
starting_afterstringCursor for pagination