# Send a bill to a sticker

> Let your till system show a bill on a TapPay sticker, and read your stickers through the API.

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

## Overview {#overview}

A TapPay [sticker](https://docs.tappay.mn/glossary.md#sticker) has a QR code and an NFC chip, and it is linked to one of your [terminals](https://docs.tappay.mn/glossary.md#terminal). Your till system can send a bill to a sticker, so the [customer](https://docs.tappay.mn/glossary.md#customer) taps or scans it and sees the amount already filled in. The API only reads your stickers, because you link, assign and close them in the merchant portal.

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

Your key needs `stickers:read` in its [scope](https://docs.tappay.mn/glossary.md#scope) to read stickers, and `payments:write` to send a bill. You use your [secret key](https://docs.tappay.mn/glossary.md#secret-key), shown below as `sk_test_YOUR_SECRET_KEY`. Link a printed sticker to your terminal in the portal first, as in [TapPay stickers](https://docs.tappay.mn/no-code/qr.md). In the [sandbox](https://docs.tappay.mn/glossary.md#sandbox) every cashier already has a test sticker, so you do not need a printed one.

## Steps {#steps}

### List your stickers {#list-your-stickers}

List the stickers of your merchant, and filter them by `terminalId` or by `status`. Each sticker has an `id`, the `serialNo` (SN) printed on its front, its `terminalId` and its `stickerType`. A `PAYMENT` sticker takes bills. A `SERVICE` sticker opens the page of the system it is assigned to. A sandbox test sticker has `virtual` set to `true`.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/stickers?status=ACTIVE" \
  -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 page = await tappay.stickers.list({ query: { status: 'ACTIVE' } }).firstPage();
console.log(JSON.stringify(page));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$page = $tappay->stickers->list(['query' => ['status' => 'ACTIVE']])->firstPage();
echo json_encode(['data' => $page->data, 'hasMore' => $page->hasMore, 'nextCursor' => $page->nextCursor]);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
page = client.stickers.list({"status": "ACTIVE"}).first_page()
print(json.dumps({"data": page.data, "has_more": page.has_more, "next_cursor": page.next_cursor}))
```

### Read a sticker {#read-a-sticker}

Read one sticker by its `id`. It shows the cashier (`paymentPointId`), the service (`merchantServiceId`), the system it is assigned to and `lastScannedAt`. A `sticker.*` [event](https://docs.tappay.mn/glossary.md#event) carries only the id of the sticker, so read the sticker after each one.

```bash title="curl"
curl -sS "https://api.tappay.mn/api/v1/stickers/STICKER_ID" \
  -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 sticker = await tappay.stickers.retrieve({ id: 'STICKER_ID' });
console.log(JSON.stringify(sticker));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$sticker = $tappay->stickers->retrieve(['id' => 'STICKER_ID']);
echo json_encode($sticker);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
sticker = client.stickers.retrieve({"id": "STICKER_ID"})
print(json.dumps(sticker))
```

### Send a bill to the sticker {#send-a-bill-to-the-sticker}

Create an [invoice](https://docs.tappay.mn/glossary.md#invoice) and set `sticker` to the SN. TapPay links its intent to the sticker and takes the terminal from the sticker. Do not send `paymentPointId` together with `sticker`. When a customer taps or scans the sticker, the [payment](https://docs.tappay.mn/glossary.md#payment) page of this intent opens. If several open bills are linked to one sticker, the latest one opens.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/invoices" \
  -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 '{"amount":1000,"description":"Table 4","orderId":"bill-'"$(uuidgen)"'","sticker":"STICKER_SN"}'
```

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

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const invoice = await tappay.invoices.create({
  body: {
    amount: 1000,
    description: 'Table 4',
    orderId: `bill-${crypto.randomUUID()}`,
    sticker: 'STICKER_SN',
  },
});
console.log(JSON.stringify(invoice));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$invoice = $tappay->invoices->create([
    'body' => [
        'amount' => 1000,
        'description' => 'Table 4',
        'orderId' => 'bill-' . vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4)) . '',
        'sticker' => 'STICKER_SN',
    ],
]);
echo json_encode($invoice);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
invoice = client.invoices.create({
    "body": {
        "amount": 1000,
        "description": "Table 4",
        "orderId": "bill-" + str(uuid.uuid4()) + "",
        "sticker": "STICKER_SN",
    },
})
print(json.dumps(invoice))
```

### Pay in the sandbox {#pay-in-the-sandbox}

Let the [simulator](https://docs.tappay.mn/glossary.md#simulator) pay the bill, as if a customer scanned the sticker. This works only with a sandbox key, and the response has the `id` of the payment.

```bash title="curl"
curl -sS -X POST "https://api.tappay.mn/api/v1/sandbox/intents/INTENT_ID/simulate" \
  -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 '{"channel":"QR","outcome":"SUCCEEDED"}'
```

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

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const result = await tappay.sandbox.simulateIntent({ id: 'INTENT_ID', body: { channel: 'QR', outcome: 'SUCCEEDED' } });
console.log(JSON.stringify(result));
```

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

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$result = $tappay->sandbox->simulateIntent(['id' => 'INTENT_ID', 'body' => ['channel' => 'QR', 'outcome' => 'SUCCEEDED']]);
echo json_encode($result);
```

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

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
result = client.sandbox.simulate_intent({"id": "INTENT_ID", "body": {"channel": "QR", "outcome": "SUCCEEDED"}})
print(json.dumps(result))
```

## Verify {#verify}

When the bill is paid, TapPay sends `payment.succeeded` to your [webhook endpoint](https://docs.tappay.mn/glossary.md#webhook-endpoint), as described in the [webhooks guide](https://docs.tappay.mn/guides/webhooks.md#create-the-endpoint). Read the payment: its `sticker` holds the `serialNo`, `sqrRef` and `name` of the sticker, and it is `null` when no sticker took the payment.

The sticker opens your bill only while the intent is open and has not expired. The sticker must also stay on the same terminal and keep the same assignment. If one of these changes, the sticker opens its usual page, and your bill can still be paid through its own `deeplink`.

The response of your invoice has a `deeplink` to the TapPay page. To show wallet buttons on your own screen instead, add `expand[]=walletLinks`, as in the [mobile app guide](https://docs.tappay.mn/guides/mobile-app.md#create-an-invoice-with-wallet-links). Set `returnUrl` and `cancelUrl` to a page of your system.

### Sticker events {#sticker-events}

TapPay sends these events when a sticker that is assigned to your system changes.

| Event | When |
| - | - |
| `sticker.assigned` | The sticker was assigned to your system, or moved to another terminal. Read it to learn the new terminal. |
| `sticker.unassigned` | The sticker is no longer assigned to your system. |
| `sticker.closed` | The sticker was closed, for example because it was lost or damaged. |
| `sticker.replaced` | A new sticker took the place of an old one. `objectId` is the new sticker, and its `replaces` names the old one. |

A replacement sends only `sticker.replaced`, so move your table or cashier to the new sticker in one step.

## Common mistakes {#common-mistakes}

- Leaving the intent of a closed bill open. The next customer who scans the sticker sees the old bill until it expires, so [cancel the intent](https://docs.tappay.mn/reference/intents/cancel.md).
- Sending `sticker` together with `paymentPointId`. TapPay answers `400` [VAL-001](https://docs.tappay.mn/errors.md#VAL-001).
- Using a wrong SN, or a sticker that is closed, belongs to another merchant or is assigned to a service. TapPay answers `404` [QR-016](https://docs.tappay.mn/errors.md#QR-016) in each case.
- Using a terminal-level key for a sticker on another terminal. TapPay also answers `404` [QR-016](https://docs.tappay.mn/errors.md#QR-016).
- Sending a bill to a sticker that is assigned to another system. Only that system may send bills to it, so TapPay answers `403` [QR-021](https://docs.tappay.mn/errors.md#QR-021).
- Trying to link, assign or close a sticker with the API. Do it in the merchant portal, as in [TapPay stickers](https://docs.tappay.mn/no-code/qr.md).

## Next steps {#next-steps}

Handle payments with the [webhooks guide](https://docs.tappay.mn/guides/webhooks.md), and show a bill as a QR code with the [QR payments guide](https://docs.tappay.mn/guides/qr-payments.md). See every field in [List stickers](https://docs.tappay.mn/reference/stickers/list.md), [Retrieve a sticker](https://docs.tappay.mn/reference/stickers/get.md) and [Create an invoice](https://docs.tappay.mn/reference/invoices/create.md).
