Skip to content

Create a promotion

View as Markdown

Creates a promotion as a DRAFT. Publish it when it is ready.

Changes in 2026-09-27

POST /api/v1/promotionsSince 2026-09-27

Authentication

Secret key (Bearer)

Headers

NameTypeRequiredValuesDescription
TapPay-Versionstringno
TapPay-Timestampstringno
TapPay-Noncestringno
TapPay-Signaturestringno
Idempotency-Keystringyes

Request body

NameTypeRequiredValuesDescription
titleobjectyes
title.mnstringyes
title.enstring | nullno
bodyobjectyes
body.mnstringyes
body.enstring | nullno
mediaarray<object>no
media[].urlstring (uri)yes
media[].kindstringyesIMAGE
benefitobjectyes
benefit.kindstringyesPERCENT_OFF, AMOUNT_OFF, FREE_ITEM, BUNDLE_PRICE, FREE_DELIVERY, LOYALTY, INFO
benefit.ratenumberno
benefit.max_amountinteger | nullno
benefit.amountintegerno
benefit.offering_idstringno
benefit.quantityintegerno
benefit.offering_idsarray<string>no
benefit.rule_textstringno
benefit.progressobject | nullno
benefit.progress.currentintegeryes
benefit.progress.targetintegeryes
scopeobjectno
scope.kindstringyesMERCHANT, LOCATIONS, OFFERINGS, CATEGORIES
scope.location_idsarray<string (uuid)>no
scope.offering_idsarray<string>no
scope.category_idsarray<string>no
conditionsobjectno
conditions.min_order_amountinteger | nullno
conditions.fulfillment_modesarray | nullno
conditions.time_windowsarray | nullno
conditions.first_order_onlybooleanno
conditions.codestring | nullno
conditions.stackablebooleanno
targetingobjectno
targeting.kindstringyesALL, NEARBY, PAST_CUSTOMERS, STICKER_VISITORS
targeting.radius_mintegerno
targeting.within_daysintegerno
starts_atstring (date-time)yes
ends_atstring | nullno
limitsobjectno
limits.per_payerinteger | nullno
limits.total_redemptionsinteger | nullno
limits.budget_amountinteger | nullno

Response 201

NameTypeRequiredValuesDescription
successbooleanyestrue
dataobjectyes
data.promotion_idstringyes
data.merchant_codestringyes
data.titleobjectyes
data.title.mnstringyes
data.title.enstring | nullno
data.bodyobjectyes
data.body.mnstringyes
data.body.enstring | nullno
data.mediaarray<object>yes
data.media[].urlstringyes
data.media[].kindstringyes
data.benefitobjectyes
data.benefit.kindstringyesPERCENT_OFF, AMOUNT_OFF, FREE_ITEM, BUNDLE_PRICE, FREE_DELIVERY, LOYALTY, INFO
data.benefit.ratenumberno
data.benefit.max_amountinteger | nullno
data.benefit.amountintegerno
data.benefit.offering_idstringno
data.benefit.quantityintegerno
data.benefit.offering_idsarray<string>no
data.benefit.rule_textstringno
data.benefit.progressobject | nullno
data.benefit.progress.currentintegeryes
data.benefit.progress.targetintegeryes
data.scopeobjectyes
data.scope.kindstringyesMERCHANT, LOCATIONS, OFFERINGS, CATEGORIES
data.scope.location_idsarray<string (uuid)>no
data.scope.offering_idsarray<string>no
data.scope.category_idsarray<string>no
data.conditionsobjectyes
data.conditions.min_order_amountinteger | nullno
data.conditions.fulfillment_modesarray | nullno
data.conditions.time_windowsarray | nullno
data.conditions.first_order_onlybooleanno
data.conditions.codestring | nullno
data.conditions.stackablebooleanno
data.targetingobjectyes
data.targeting.kindstringyesALL, NEARBY, PAST_CUSTOMERS, STICKER_VISITORS
data.targeting.radius_mintegerno
data.targeting.within_daysintegerno
data.starts_atstringyes
data.ends_atstring | nullyes
data.limitsobjectyes
data.limits.per_payerinteger | nullno
data.limits.total_redemptionsinteger | nullno
data.limits.budget_amountinteger | nullno
data.statusstringyesDRAFT, SCHEDULED, ACTIVE, PAUSED, ENDED, BLOCKED
data.status_reasonstring | nullyes
data.versionintegeryes
data.redeemed_countintegeryes
data.redeemed_amountintegeryes
data.published_atstring | nullyes
data.created_atstringyes
data.updated_atstringyes

Errors

CodeStatusMessage
AUTH-001401The API key is missing, invalid or revoked.
EVT-206401Production keys are not accepted in the sandbox. Use a sandbox key (sk_test_/pk_test_).
EVT-207401Sandbox keys are not accepted in production. Use a production key (sk_live_/pk_live_).
AUTH-018403The request came from an IP address that is not on the key's allowlist.
AUTH-058403The API key does not have the scope this operation requires.
SIG-002401The request timestamp is outside the allowed time window.
SIG-003401The request signature is missing or does not match.
SIG-005409This request nonce was already used.
VAL-014400The TapPay-Version header is not a known API version.
BIZ-004403The terminal is not active.
BIZ-005403The merchant account is not in a state that allows this request.
VAL-002400A required field or header is missing.
VAL-010409This Idempotency-Key was already used with a different request body.
VAL-013409A request with this Idempotency-Key is still being processed.
PRM-002422A promotion field is not valid.
PRM-006409The promo code is already used by another promotion.
curl -sS -X POST "https://api.tappay.mn/api/v1/promotions" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)" \
  -H "Content-Type: application/json" \
  -d '{"title":{"mn":"Кофе 10% хямд","en":"10% off coffee"},"body":{"mn":"Бүх кофе 10% хямд.","en":"All coffee is 10% off."},"benefit":{"kind":"PERCENT_OFF","rate":10,"max_amount":5000},"starts_at":"2026-10-05T00:00:00.000Z","ends_at":"2026-10-31T15:59:59.000Z","limits":{"per_payer":1}}'
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const promotion = await tappay.promotions.create({
  body: {
    title: {
      mn: 'Кофе 10% хямд',
      en: '10% off coffee',
    },
    body: {
      mn: 'Бүх кофе 10% хямд.',
      en: 'All coffee is 10% off.',
    },
    benefit: {
      kind: 'PERCENT_OFF',
      rate: 10,
      max_amount: 5000,
    },
    starts_at: '2026-10-05T00:00:00.000Z',
    ends_at: '2026-10-31T15:59:59.000Z',
    limits: {
      per_payer: 1,
    },
  },
});
console.log(JSON.stringify(promotion));
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$promotion = $tappay->promotions->create([
    'body' => [
        'title' => [
            'mn' => 'Кофе 10% хямд',
            'en' => '10% off coffee',
        ],
        'body' => [
            'mn' => 'Бүх кофе 10% хямд.',
            'en' => 'All coffee is 10% off.',
        ],
        'benefit' => [
            'kind' => 'PERCENT_OFF',
            'rate' => 10,
            'max_amount' => 5000,
        ],
        'starts_at' => '2026-10-05T00:00:00.000Z',
        'ends_at' => '2026-10-31T15:59:59.000Z',
        'limits' => [
            'per_payer' => 1,
        ],
    ],
]);
echo json_encode($promotion);
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
promotion = client.promotions.create({
    "body": {
        "title": {
            "mn": "Кофе 10% хямд",
            "en": "10% off coffee",
        },
        "body": {
            "mn": "Бүх кофе 10% хямд.",
            "en": "All coffee is 10% off.",
        },
        "benefit": {
            "kind": "PERCENT_OFF",
            "rate": 10,
            "max_amount": 5000,
        },
        "starts_at": "2026-10-05T00:00:00.000Z",
        "ends_at": "2026-10-31T15:59:59.000Z",
        "limits": {
            "per_payer": 1,
        },
    },
})
print(json.dumps(promotion))
{
  "success": true,
  "data": {
    "promotion_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f06",
    "merchant_code": "M-SANDBOX-01",
    "title": {
      "mn": "Кофе 10% хямд",
      "en": "10% off coffee"
    },
    "body": {
      "mn": "Бүх кофе 10% хямд.",
      "en": "All coffee is 10% off."
    },
    "media": [],
    "benefit": {
      "kind": "PERCENT_OFF",
      "rate": 10,
      "max_amount": 5000
    },
    "scope": {
      "kind": "MERCHANT"
    },
    "conditions": {
      "min_order_amount": null,
      "fulfillment_modes": null,
      "time_windows": null,
      "first_order_only": false,
      "code": null,
      "stackable": false
    },
    "targeting": {
      "kind": "ALL"
    },
    "starts_at": "2026-10-05T00:00:00.000Z",
    "ends_at": "2026-10-31T15:59:59.000Z",
    "limits": {
      "per_payer": 1,
      "total_redemptions": null,
      "budget_amount": null
    },
    "status": "DRAFT",
    "status_reason": null,
    "version": 1,
    "redeemed_count": 0,
    "redeemed_amount": 0,
    "published_at": null,
    "created_at": "2026-10-03T08:15:00.000Z",
    "updated_at": "2026-10-03T08:15:00.000Z"
  }
}