# Run a promotion

> Create a discount for wallet users, publish it, pause or end it, and read its results.

Source: https://docs.tappay.mn/guides/promotions/

## Overview {#overview}

A promotion is a discount or a piece of news from your business that wallets show to their users. You create it as a draft and publish it, and TapPay applies the discount when a [customer](https://docs.tappay.mn/glossary.md#customer) orders from you in a wallet. You fund the discount, while your fees and [settlement](https://docs.tappay.mn/glossary.md#settlement) stay the same.

## Before you begin {#before-you-begin}

Your key needs the `promotions:write` [scope](https://docs.tappay.mn/glossary.md#scope), and you use your [secret key](https://docs.tappay.mn/glossary.md#secret-key), shown below as `sk_test_YOUR_SECRET_KEY`. Use a [sandbox](https://docs.tappay.mn/glossary.md#sandbox) key while you build. TapPay sends no push or SMS to users itself. Each wallet notifies its own users, with their marketing consent.

## Steps {#steps}

### Create a promotion {#create-a-promotion}

Send a `title` and a `body` in Mongolian (`mn`), and in English (`en`) if you want. The title can have up to 60 characters and the body up to 240, and the body must not contain links or phone numbers. Set `starts_at`, and set `ends_at` if the promotion should stop on a date. The `benefit` says what the customer gets. A new promotion starts as `DRAFT`.

```bash title="curl"
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-12-01T00:00:00.000Z","ends_at":"2027-12-31T15:59:59.000Z","limits":{"per_payer":1}}'
```

```js title="Node.js"
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-12-01T00:00:00.000Z',
    ends_at: '2027-12-31T15:59:59.000Z',
    limits: { per_payer: 1 },
  },
});
console.log(JSON.stringify(promotion));
```

```php title="PHP"
<?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-12-01T00:00:00.000Z',
        'ends_at' => '2027-12-31T15:59:59.000Z',
        'limits' => ['per_payer' => 1],
    ],
]);
echo json_encode($promotion);
```

```python title="Python"
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-12-01T00:00:00.000Z",
        "ends_at": "2027-12-31T15:59:59.000Z",
        "limits": {"per_payer": 1},
    },
})
print(json.dumps(promotion))
```

| `benefit.kind` | Fields | What the customer gets |
| - | - | - |
| `PERCENT_OFF` | `rate`, `max_amount` | A percentage off, at most `max_amount` if you set it |
| `AMOUNT_OFF` | `amount` | A fixed amount off |
| `FREE_ITEM` | `offering_id`, `quantity` | An item for free |
| `BUNDLE_PRICE` | `offering_ids`, `amount` | A set of items for one price |
| `FREE_DELIVERY` | `max_amount` | Free delivery, at most `max_amount` if you set it |
| `LOYALTY` | `rule_text`, `progress` | A loyalty rule to show, with no discount |
| `INFO` | — | News such as a new menu or an opening, with no discount |

`limits.per_payer` is how many times one customer may use the promotion: 1 by default, and `0` for no limit. `total_redemptions` and `budget_amount` cap the whole promotion. `scope` limits it to some `LOCATIONS`, `OFFERINGS` or `CATEGORIES` instead of the whole `MERCHANT`. `conditions` can ask for a `min_order_amount`, a promo `code`, `time_windows` or `first_order_only`. `targeting` chooses whom wallets notify: `ALL` by default, or `NEARBY`, `PAST_CUSTOMERS` and `STICKER_VISITORS`. A targeted promotion reaches only users who allowed personal offers in their wallet.

### Change the promotion {#change-the-promotion}

You can change a promotion while it is `DRAFT`, `SCHEDULED` or `PAUSED`. Send only the fields that change. Every change adds 1 to `version`. To avoid overwriting another change, send the `version` you read in an `If-Match` header, and TapPay answers `409` [PRM-003](https://docs.tappay.mn/errors.md#PRM-003) if it differs.

```bash title="curl"
curl -sS -X PATCH "https://api.tappay.mn/api/v1/promotions/PROMOTION_ID" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Content-Type: application/json" \
  -d '{"benefit":{"kind":"PERCENT_OFF","rate":15,"max_amount":5000}}'
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const promotion = await tappay.promotions.update({ promotion_id: 'PROMOTION_ID', body: { benefit: { kind: 'PERCENT_OFF', rate: 15, max_amount: 5000 } } });
console.log(JSON.stringify(promotion));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$promotion = $tappay->promotions->update(['promotion_id' => 'PROMOTION_ID', 'body' => ['benefit' => ['kind' => 'PERCENT_OFF', 'rate' => 15, 'max_amount' => 5000]]]);
echo json_encode($promotion);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
promotion = client.promotions.update({"promotion_id": "PROMOTION_ID", "body": {"benefit": {"kind": "PERCENT_OFF", "rate": 15, "max_amount": 5000}}})
print(json.dumps(promotion))
```

### Publish the promotion {#publish-the-promotion}

Publishing makes the promotion `SCHEDULED` until `starts_at`, and then `ACTIVE`. If `starts_at` has already passed, as in this example, it becomes `ACTIVE` at once. Once it is active, wallets can show it to their users.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/promotions/PROMOTION_ID/publish" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const promotion = await tappay.promotions.publish({ promotion_id: 'PROMOTION_ID' });
console.log(JSON.stringify(promotion));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$promotion = $tappay->promotions->publish(['promotion_id' => 'PROMOTION_ID']);
echo json_encode($promotion);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
promotion = client.promotions.publish({"promotion_id": "PROMOTION_ID"})
print(json.dumps(promotion))
```

### Pause the promotion {#pause-the-promotion}

Pause an `ACTIVE` promotion to stop it for a while, and it becomes `PAUSED`. Wallets then stop the notifications they have not sent yet. To resume it, publish it again.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/promotions/PROMOTION_ID/pause" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const promotion = await tappay.promotions.pause({ promotion_id: 'PROMOTION_ID' });
console.log(JSON.stringify(promotion));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$promotion = $tappay->promotions->pause(['promotion_id' => 'PROMOTION_ID']);
echo json_encode($promotion);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
promotion = client.promotions.pause({"promotion_id": "PROMOTION_ID"})
print(json.dumps(promotion))
```

### Read the results {#read-the-results}

The results show how many users the promotion was for (`audience`), how many got it (`delivered`), opened it (`opened`) and used it (`redeemed`). `discount_total` is the sum of the discounts, and `order_total` is the sum of those orders. You see totals only, never single users or the numbers of each bank.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/promotions/PROMOTION_ID/stats" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const stats = await tappay.promotions.stats({ promotion_id: 'PROMOTION_ID' });
console.log(JSON.stringify(stats));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$stats = $tappay->promotions->stats(['promotion_id' => 'PROMOTION_ID']);
echo json_encode($stats);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
stats = client.promotions.stats({"promotion_id": "PROMOTION_ID"})
print(json.dumps(stats))
```

### End the promotion {#end-the-promotion}

End a promotion when you no longer need it. It becomes `ENDED` and cannot be published again. A promotion also ends by itself when its discounts reach `budget_amount`.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/promotions/PROMOTION_ID/end" \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "TapPay-Version: 2026-09-27" \
  -H "Idempotency-Key: $(openssl rand -hex 16)"
```

```js title="Node.js"
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const promotion = await tappay.promotions.end({ promotion_id: 'PROMOTION_ID' });
console.log(JSON.stringify(promotion));
```

```php title="PHP"
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$promotion = $tappay->promotions->end(['promotion_id' => 'PROMOTION_ID']);
echo json_encode($promotion);
```

```python title="Python"
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
promotion = client.promotions.end({"promotion_id": "PROMOTION_ID"})
print(json.dumps(promotion))
```

## Verify {#verify}

Read the promotion with [Retrieve a promotion](https://docs.tappay.mn/reference/promotions/get.md) to see its `status`. Its `redeemed_count` and `redeemed_amount` grow as customers use it. If TapPay blocks a promotion, for example for misleading content, its `status` is `BLOCKED` and `status_reason` says why. Promotion [events](https://docs.tappay.mn/glossary.md#event) go only to wallets, so read the promotion when you need its state.

TapPay works out the discount itself, and wallets never do it. In the [invoice](https://docs.tappay.mn/glossary.md#invoice) the discount lowers the lines that it covers, so there is no negative line. If you publish between 22:00 and 08:00, wallets get the users to notify after 08:00.

## Common mistakes {#common-mistakes}

- Putting a link or a phone number in `body`, or a title longer than 60 characters. TapPay answers [PRM-002](https://docs.tappay.mn/errors.md#PRM-002).
- Publishing more than 20 active promotions, or more targeted promotions in a month than your limit, which is 8 by default. TapPay answers [PRM-004](https://docs.tappay.mn/errors.md#PRM-004).
- Changing or publishing an ended promotion. TapPay answers [PRM-003](https://docs.tappay.mn/errors.md#PRM-003), so create a new promotion instead.
- Giving a promo `code` that another promotion already uses. TapPay answers [PRM-006](https://docs.tappay.mn/errors.md#PRM-006).
- Changing a promotion that TapPay blocked. TapPay answers [PRM-005](https://docs.tappay.mn/errors.md#PRM-005).
- Expecting a discount on a [payment](https://docs.tappay.mn/glossary.md#payment) without an order, such as a QR or checkout payment. A promotion applies to orders.

## Next steps {#next-steps}

See every field in [Create a promotion](https://docs.tappay.mn/reference/promotions/create.md), [Update a promotion](https://docs.tappay.mn/reference/promotions/update.md) and [Publish a promotion](https://docs.tappay.mn/reference/promotions/publish.md). The other calls are [Pause a promotion](https://docs.tappay.mn/reference/promotions/pause.md), [End a promotion](https://docs.tappay.mn/reference/promotions/end.md) and [Promotion results](https://docs.tappay.mn/reference/promotions/stats.md). To see all your promotions, use [List promotions](https://docs.tappay.mn/reference/promotions/list.md).
