Skip to content

Create an order

View as Markdown

Creates an order from your own website or app in the merchant’s name. external_ref must be unique for your merchant. The response has the order_page_url to open for the customer and the intent_id of the payment. For the full flow, read the external orders guide.

Limits: each line quantity ≤ 9999, unit_price ≤ 9,999,999,999,999; a total above the merchant’s invoice_max/txn_limits returns SET-007. offering_id is the catalog ID (for example SKU-LATTE), up to 64 characters.

Changes in 2026-09-27

POST /api/v1/commerce/ordersSince 2026-09-27

Authentication

Secret key (Bearer)

Headers

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

Request body

NameTypeRequiredValuesDescription
location_idstring (uuid)yes
external_refstringyes
linesarray<object>yes
lines[].namestringyes
lines[].quantityintegeryes
lines[].unit_priceintegeryes
lines[].offering_idstringno
lines[].notestringno
fulfillmentobjectyes
fulfillment.modestringyesPICKUP, AT_MERCHANT, DIGITAL, DELIVERY
fulfillment.deliverystringnoSELF, DISPATCH
fulfillment.addressobjectno
fulfillment.address.labelstring | nullno
fulfillment.address.textstringyes
fulfillment.address.entrancestring | nullno
fulfillment.address.floorstring | nullno
fulfillment.address.doorstring | nullno
fulfillment.address.notestring | nullno
fulfillment.address.locationobject | nullno
fulfillment.address.location.latnumberyes
fulfillment.address.location.lngnumberyes
fulfillment.address.districtstring | nullno
fulfillment.address.khoroostring | nullno
fulfillment.scheduled_atstring (date-time)no
customerobjectyes
customer.namestringyes
customer.phonestringyes
notestringno

Response 201

NameTypeRequiredValuesDescription
successbooleanyestrue
dataobjectyes
data.order_idstring (uuid)yes
data.order_nostringyes
data.channelstringyes
data.statusstringyesCREATED, ACCEPTED, AWAITING_PAYMENT, CONFIRMED, IN_PROGRESS, READY, COMPLETED, CANCELLED, REJECTED, EXPIRED, FAILED
data.versionintegeryes
data.merchantobjectyes
data.merchant.merchant_codestringyes
data.merchant.namestringyes
data.location_idstring (uuid)yes
data.fulfillmentobjectyes
data.fulfillment.modestringyes
data.fulfillment.labelstringyes
data.fulfillment.addressobject | nullyes
data.fulfillment.address.labelstring | nullyes
data.fulfillment.address.textstringyes
data.fulfillment.address.entrancestring | nullno
data.fulfillment.address.floorstring | nullno
data.fulfillment.address.doorstring | nullno
data.fulfillment.address.notestring | nullno
data.fulfillment.address.locationobject | nullyes
data.fulfillment.address.location.latnumberyes
data.fulfillment.address.location.lngnumberyes
data.fulfillment.address.districtstring | nullno
data.fulfillment.address.khoroostring | nullno
data.fulfillment.scheduled_atstring | nullyes
data.fulfillment.ends_atstring | nullyes
data.linesarray<object>yes
data.lines[].line_idstringyes
data.lines[].offering_idstringyes
data.lines[].namestringyes
data.lines[].quantityintegeryes
data.lines[].variant_idstring | nullyes
data.lines[].option_idsarray<string>yes
data.lines[].inputsobjectyes
data.lines[].amountnumberyes
data.lines[].statusstringyes
data.lines[].final_amountnumber | nullyes
data.breakuparray<object>yes
data.breakup[].kindstringyes
data.breakup[].labelstringyes
data.breakup[].amountnumberyes
data.breakup[].refstring | nullno
data.totalnumberyes
data.feesarray<object>yes
data.fees[].kindstringyes
data.fees[].labelstringyes
data.fees[].amountnumberyes
data.fees[].estimatedbooleanyes
data.payable_totalnumberyes
data.authorization_typestringyes
data.authorization_amountnumber | nullyes
data.accepted_totalnumber | nullyes
data.final_amountnumber | nullyes
data.stageobject | nullyes
data.stage.codestringyes
data.stage.labelstringyes
data.stage.descriptionstring | nullno
data.timelinearray<object>yes
data.timeline[].atstringyes
data.timeline[].labelstringyes
data.timeline[].statusstring | nullno
data.eta_atstring | nullyes
data.trackingobject | nullyes
data.tracking.agentobject | nullyes
data.tracking.agent.namestringyes
data.tracking.agent.phone_maskedstring | nullyes
data.tracking.agent.photo_urlstring | nullyes
data.tracking.agent.provider_labelstring | nullyes
data.tracking.locationobject | nullyes
data.tracking.location.latnumberyes
data.tracking.location.lngnumberyes
data.tracking.location.atstringyes
data.tracking.eta_atstring | nullyes
data.tracking.tracking_urlstring | nullyes
data.tracking.static_map_urlstring | nullyes
data.artifactsarray<object>yes
data.artifacts[].artifact_idstringyes
data.artifacts[].kindstringyes
data.artifacts[].labelstringyes
data.artifacts[].valuestring | nullno
data.artifacts[].urlstring | nullno
data.artifacts[].valid_fromstring | nullno
data.artifacts[].valid_tostring | nullno
data.artifacts[].fallback_urlstringyes
data.actionsarray<object>yes
data.actions[].kindstringyes
data.actions[].allowedbooleanyes
data.actions[].deadlinestringno
data.actions[].labelstringyes
data.actions[].urlstringno
data.next_actionobject | nullyes
data.next_action.typestringyes
data.next_action.intent_idstringno
data.next_action.diffobjectno
data.next_action.diff.linesarray<object>yes
data.next_action.diff.lines[].offering_idstringyes
data.next_action.diff.lines[].beforeobject | nullyes
data.next_action.diff.lines[].before.quantityintegeryes
data.next_action.diff.lines[].before.amountnumberyes
data.next_action.diff.lines[].afterobject | nullyes
data.next_action.diff.lines[].after.quantityintegeryes
data.next_action.diff.lines[].after.amountnumberyes
data.next_action.diff.total_beforenumberyes
data.next_action.diff.total_afternumberyes
data.next_action.diff.scheduleobjectno
data.next_action.diff.schedule.beforeobjectyes
data.next_action.diff.schedule.before.scheduled_atstring | nullyes
data.next_action.diff.schedule.before.ends_atstring | nullno
data.next_action.diff.schedule.afterobjectyes
data.next_action.diff.schedule.after.scheduled_atstring | nullyes
data.next_action.diff.schedule.after.ends_atstring | nullno
data.next_action.urlstringno
data.next_action.untilstringno
data.web_urlstringyes
data.payment_idstring | nullyes
data.cancelled_bystring | nullyes
data.reason_codestring | nullyes
data.created_atstringyes
data.updated_atstringyes
data.promotionsarray<object>no
data.promotions[].promotion_idstring (uuid)yes
data.promotions[].kindstringyes
data.promotions[].amountnumberyes
data.customerobjectyes
data.customer.contact_namestring | nullyes
data.customer.contact_phonestring | nullyes
data.notestring | nullyes
data.accept_due_atstring | nullyes
data.pending_rescheduleobject | nullyes
data.pending_reschedule.scheduled_atstringyes
data.pending_reschedule.ends_atstring | nullyes
data.handler_systemstringyes
data.payment_due_atstring | nullyes
data.sourceobjectyes
data.source.channelstringyes
data.source.partner_namestring | nullyes
data.source.stickerobject | nullyes
data.source.sticker.namestring | nullyes
data.order_page_urlstring (uri)yes
data.intent_idstring | nullyes

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.
CAT-008404The catalog entry, location or offering was not found.
ORD-007422The merchant is not accepting orders right now.
ORD-019409An order with this external_ref already exists.
ORD-020422The order lines or fulfillment are not valid.
SET-007422The value violates a platform limit.
curl -sS -X POST "https://api.tappay.mn/api/v1/commerce/orders" \
  -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 '{"location_id":"0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01","external_ref":"web-1001","lines":[{"name":"Latte (M)","quantity":2,"unit_price":9000,"offering_id":"SKU-LATTE"}],"fulfillment":{"mode":"PICKUP"},"customer":{"name":"Bat","phone":"+97699000000"}}'
import { TapPay } from '@tappay-mn/node';

const tappay = new TapPay({ apiKey: 'sk_test_YOUR_SECRET_KEY' });
const result = await tappay.commerce.create({
  body: {
    location_id: '0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01',
    external_ref: 'web-1001',
    lines: [
      {
        name: 'Latte (M)',
        quantity: 2,
        unit_price: 9000,
        offering_id: 'SKU-LATTE',
      },
    ],
    fulfillment: {
      mode: 'PICKUP',
    },
    customer: {
      name: 'Bat',
      phone: '+97699000000',
    },
  },
});
console.log(JSON.stringify(result));
<?php
require 'vendor/autoload.php';

use TapPay\TapPay;

$tappay = new TapPay(['apiKey' => 'sk_test_YOUR_SECRET_KEY']);
$result = $tappay->commerce->create([
    'body' => [
        'location_id' => '0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01',
        'external_ref' => 'web-1001',
        'lines' => [
            [
                'name' => 'Latte (M)',
                'quantity' => 2,
                'unit_price' => 9000,
                'offering_id' => 'SKU-LATTE',
            ],
        ],
        'fulfillment' => [
            'mode' => 'PICKUP',
        ],
        'customer' => [
            'name' => 'Bat',
            'phone' => '+97699000000',
        ],
    ],
]);
echo json_encode($result);
import json
import tappay

client = tappay.TapPay("sk_test_YOUR_SECRET_KEY")
result = client.commerce.create({
    "body": {
        "location_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01",
        "external_ref": "web-1001",
        "lines": [
            {
                "name": "Latte (M)",
                "quantity": 2,
                "unit_price": 9000,
                "offering_id": "SKU-LATTE",
            },
        ],
        "fulfillment": {
            "mode": "PICKUP",
        },
        "customer": {
            "name": "Bat",
            "phone": "+97699000000",
        },
    },
})
print(json.dumps(result))
{
  "success": true,
  "data": {
    "order_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f02",
    "order_no": "A-1001",
    "channel": "WALLET",
    "status": "AWAITING_PAYMENT",
    "version": 4,
    "merchant": {
      "merchant_code": "M-SANDBOX-01",
      "name": "Sandbox Cafe"
    },
    "location_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f01",
    "fulfillment": {
      "mode": "PICKUP",
      "label": "Pickup",
      "address": null,
      "scheduled_at": null,
      "ends_at": null
    },
    "lines": [
      {
        "line_id": "l1",
        "offering_id": "SKU-LATTE",
        "name": "Latte (M)",
        "quantity": 2,
        "variant_id": null,
        "option_ids": [],
        "inputs": {},
        "amount": 18000,
        "status": "ACTIVE",
        "final_amount": null
      }
    ],
    "breakup": [
      {
        "kind": "ITEM",
        "label": "Latte (M) x 2",
        "amount": 18000,
        "ref": "SKU-LATTE"
      }
    ],
    "total": 18000,
    "fees": [],
    "payable_total": 18000,
    "authorization_type": "FINAL",
    "authorization_amount": null,
    "accepted_total": null,
    "final_amount": null,
    "stage": null,
    "timeline": [
      {
        "at": "2026-10-03T08:15:00.000Z",
        "label": "Order created",
        "status": "CREATED"
      }
    ],
    "eta_at": null,
    "tracking": null,
    "artifacts": [],
    "actions": [],
    "next_action": null,
    "web_url": "https://pay.tappay.mn/o/ord_7f3k2m9q",
    "payment_id": null,
    "cancelled_by": null,
    "reason_code": null,
    "created_at": "2026-10-03T08:15:00.000Z",
    "updated_at": "2026-10-03T08:20:00.000Z",
    "promotions": [],
    "customer": {
      "contact_name": "Bat",
      "contact_phone": "+97699000000"
    },
    "note": null,
    "accept_due_at": null,
    "pending_reschedule": null,
    "handler_system": "MERCHANT_SYSTEM",
    "payment_due_at": "2026-10-03T08:30:00.000Z",
    "source": {
      "channel": "HOSTED",
      "partner_name": null,
      "sticker": null
    },
    "order_page_url": "https://pay.tappay.mn/o/ord_7f3k2m9q",
    "intent_id": "0192f8a4-1b2c-7d3e-8f40-5a6b7c8d9f05"
  }
}