APG PayAPG Paydocs

Orders

Create orders

POST/orders

Create an order, optionally with a payment link. Selected by the body's type.

2 actionsOrdrCmdCreateOrdrCmdCreateInvoice

Permissions

Required permission
orders:create

Requires the `create` action on `orders` for the supplied runtime context

Request body

This body is a typed union. Pick a variant to see its fields and a matching example.

Discriminated by type
type = "OrdrCmdCreate"

The order to create.

curl -X POST https://api.tst.au.apgpay.dev/orders \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "OrdrCmdCreate",
  "order": {
    "type": "OrdrNewOrderAttributes",
    "merchantId": "mcht_9f2Kd8QpLzXw",
    "customerId": "cust_9f2Kd8QpLzXw",
    "orderType": "Online",
    "referenceOrderId": "your-own-reference",
    "description": "string",
    "amount": 1250,
    "currency": "AUD",
    "billing": {
      "type": "OrdrBillingAttributes",
      "name": "Ada Lovelace",
      "address": {
        "type": "OrdrAddressAttributes",
        "line1": "string",
        "line2": "string",
        "city": "string",
        "state": "string",
        "postalCode": "3000",
        "country": "AU"
      },
      "phone": "+61400000000"
    },
    "emailAddress": "ada@example.com",
    "phoneNumber": "+61400000000",
    "lineItems": [
      {
        "type": "OrdrNewLineItemAttributes",
        "description": "string",
        "quantity": 12.5,
        "amount": 1250,
        "sku": "string",
        "imageUrl": "https://example.com/callback"
      }
    ],
    "taxIncluded": true,
    "taxAmount": 1250,
    "discount": 1250,
    "shipping": {
      "type": "OrdrShippingAttributes",
      "name": "Ada Lovelace",
      "address": {
        "type": "OrdrAddressAttributes",
        "line1": "string",
        "line2": "string",
        "city": "string",
        "state": "string",
        "postalCode": "3000",
        "country": "AU"
      },
      "amount": 1250,
      "carrier": "string",
      "trackingNumber": "string",
      "phone": "+61400000000"
    },
    "request3DSOnPayment": true,
    "emailCustomerReceipt": true,
    "settlement": "Default",
    "metadata": {
      "yourKey": {}
    }
  }
}'

Responses

The response is a typed union.

Discriminated by type
type = "OrdrCreateRspInvoice"

An order, the commerce record a payment settles.

Example
{
  "type": "OrdrCreateRspInvoice",
  "created": {
    "type": "OrdrViewAttributes",
    "orderId": "ordr_9f2Kd8QpLzXw",
    "merchantId": "mcht_9f2Kd8QpLzXw",
    "marketplaceId": "mktp_9f2Kd8QpLzXw",
    "customer": {
      "type": "OrdrCustomerAttributes",
      "name": "Ada Lovelace",
      "emailAddress": "ada@example.com",
      "phoneNumber": "+61400000000"
    },
    "status": "Created",
    "orderType": "Online",
    "amounts": {
      "type": "OrdrAmountsAttributes",
      "currency": "AUD",
      "total": 1250,
      "tax": 1250,
      "paid": 1250,
      "outstanding": 1250,
      "surcharge": 1250,
      "discount": 1250
    },
    "lineItems": [
      {
        "type": "OrdrLineItemInvoice",
        "description": "string",
        "unitCount": 12.5,
        "fee": 1250,
        "tax": 1250,
        "value": 1250,
        "category": "string",
        "notes": "string"
      }
    ],
    "description": "string",
    "shipping": {
      "type": "OrdrShippingAttributes",
      "name": "Ada Lovelace",
      "address": {
        "type": "OrdrAddressAttributes",
        "line1": "string",
        "line2": "string",
        "city": "string",
        "state": "string",
        "postalCode": "3000",
        "country": "AU"
      },
      "amount": 1250,
      "carrier": "string",
      "trackingNumber": "string",
      "phone": "+61400000000"
    },
    "billing": {
      "type": "OrdrBillingAttributes",
      "name": "Ada Lovelace",
      "address": {
        "type": "OrdrAddressAttributes",
        "line1": "string",
        "line2": "string",
        "city": "string",
        "state": "string",
        "postalCode": "3000",
        "country": "AU"
      },
      "phone": "+61400000000"
    },
    "settlement": "Default",
    "request3DSOnPayment": true,
    "emailCustomerReceipt": true,
    "referenceOrderId": "your-own-reference",
    "metadata": {
      "yourKey": {}
    },
    "createdAt": "2026-08-19T04:21:07Z",
    "updatedAt": "2026-08-19T04:21:07Z"
  },
  "paymentLink": {
    "type": "OrdrPaymentLinkAttributes",
    "token": "tok_9f2Kd8QpLzXwR4mN",
    "url": "https://example.com/callback"
  }
}

Error responses