Meet Toki Operator

Docs/Wallet SDK

Orders

Show a customer's order and its progress, and let them buy it again, start a return or track it in Apple Wallet.

Toki keeps each order from your store with the customer who placed it. Order IDs are Shopify's order IDs, such as {{ order.id }} in Liquid, and amounts are in your store currency, as numbers such as 62.6.

getOrderDetails#

tokiWallet.getOrderDetails({ orderId, reviewGroupId? })→ Promise<OrderDetails>

Returns one of the customer's orders, with its progress, line items, totals and shipping details.

status gives the order's step for a progress tracker, with a label in the storefront's language, and details.fulfillments the tracking links. The order must be one of the signed-in customer's; otherwise it rejects with Order not found or access denied.

Pass a reviewGroupId to ask for reviews: lineItemReviews then lists each product in the order, with the customer's review of it and a link to write or edit it.

Options

one object
  • orderIdstringRequired

    Shopify's order ID, such as {{ order.id }} in Liquid.

  • reviewGroupIdstring

    A review group, from getReviewGroups, to fill lineItemReviews.

Returns

Promise<OrderDetails>
  • detailsOrder

    The order.

    16 fields
    • idstring

      Shopify's order ID.

    • namestring

      The order number customers see, such as #1042.

    • createdAtstring

      When the order was placed, as an ISO 8601 date-time.

    • cancelledAtstring | null

      When the order was cancelled; null if it wasn't.

    • orderStatusUrlstring

      The order's status page in your store.

    • totalPricenumber

      The order's total, with shipping, tax and discounts.

    • currentTotalPricenumber | nullOptional

      The total after any edits and refunds.

    • subtotalPricenumber

      The items' total after discounts, before shipping.

    • presentmentTotalPrice{ amount: number; currencyCode: string } | nullOptional

      The total in the currency the customer paid in.

    • lineItemsOrderLineItem[]
      10 fields per item
      • idstring
      • namestring

        The product and variant, such as Cloud Hoodie - M / Sand.

      • productIdstring

        The numeric Shopify product ID.

      • variantIdstring

        The numeric Shopify variant ID.

      • quantitynumber

        The quantity ordered.

      • currentQuantitynumberOptional

        The quantity after any edits and refunds.

      • pricenumber

        The price of one item, before discounts.

      • totalDiscountnumberOptional

        Discounts on the whole line.

      • totalTaxnumberOptional

        Tax on the whole line.

      • properties{ name: string; value: string }[]Optional

        The line item properties.

    • shippingLines{ name: string; price: number | null; discountedPrice: number | null }[]Optional

      Shipping methods with their price, before and after shipping discounts.

    • shippingAddressobjectOptional

      firstName, lastName, name, company, address1, address2, city, province, provinceCode, zip, country, countryCode and phone, each a string or null.

    • customer{ email: string | null; name: string | null; phone: string | null }

      The customer as the order records them.

    • statusesobjectOptional

      Shopify's statuses for the order.

      3 fields
      • fulfillmentStatusstring | nullOptional

        Such as UNFULFILLED, PARTIALLY_FULFILLED or FULFILLED.

      • financialStatusstring | nullOptional

        Such as PAID, PARTIALLY_REFUNDED or REFUNDED.

      • deliveryStatus"DELIVERED" | "NOT_DELIVERED" | nullOptional

        DELIVERED once a shipment has been delivered.

    • fulfillmentsOrderFulfillment[]Optional

      The order's shipments.

      3 fields per item
      • displayStatusstring

        Shopify's shipment status, such as IN_TRANSIT, OUT_FOR_DELIVERY or DELIVERED.

      • deliveredAtstring | nullOptional

        When the shipment was delivered, as an ISO 8601 date-time.

      • trackingInfo{ company: string | null; url: string | null }[]

        The carrier and tracking link of each package.

    • tagsstring[]

      The order's tags in your store.

  • statusOrderStatus

    The order's progress, for a tracker with four steps.

    6 fields
    • key"orderPlaced" | "shipped" | "partiallyFulfilled" | "outForDelivery" | "delivered" | "cancelled"

      shipped once the items are fulfilled and on their way, partiallyFulfilled when only some items are fulfilled, outForDelivery when a shipment is out for delivery or ready for pickup, and delivered once the fulfilled order has been delivered or picked up.

    • stepnumber

      The step from 1 (orderPlaced) to 4 (delivered): shipped and partiallyFulfilled are 2, and outForDelivery is 3. cancelled is 0.

    • currentStatusLabelstring

      The status in the storefront's language, such as Out for delivery.

    • timestampstring

      When the order was cancelled, for cancelled; otherwise when it was last updated. ISO 8601.

    • descriptionstring | nullOptional

      For delivered, a line such as Delivered on October 3, 2026 at 02:15 PM.

    • steps{ key: string }[]

      The tracker's steps: orderPlaced, shipped, outForDelivery and delivered.

  • lineItemReviewsOrderLineItemReview[]

    With a reviewGroupId, one entry per product in the order, when the customer can review in that group. Otherwise empty.

    4 fields per item
    • productIdstring

      The numeric Shopify product ID.

    • reviewIdstring | null

      The customer's review of the product from this order; null before they review it.

    • status"pending" | "approved" | "rejected" | null

      That review's status.

    • urlstring | null

      A link to Toki's review page for the product, signed in as the customer, valid for 2 hours; null once the review is approved.

  • isReturnIntegrationEnabledboolean

    Whether your Loop Returns integration is connected, for getReturnLink.

  • isAppleWalletOrdersEnabledboolean

    Whether the customer can add this order to Apple Wallet with getAppleWalletOrderLink.

Example
const { details, status } =
  await tokiWallet.getOrderDetails({
    orderId: "5823749201234",
    reviewGroupId: "6f1c9a3e-2b4d-4c8e-9f7a-1d2e3f4a5b6c",
  })
Result
{
  "details": {
    "id": "5823749201234",
    "name": "#1042",
    "createdAt": "2026-09-14T15:32:08.000Z",
    "cancelledAt": null,
    "orderStatusUrl": "https://example.com/61234567890/orders/9c1f2e3d4b5a6978/authenticate?key=…",
    "totalPrice": 62.6,
    "currentTotalPrice": 62.6,
    "subtotalPrice": 57.6,
    "presentmentTotalPrice": {
      "amount": 62.6,
      "currencyCode": "USD"
    },
    "lineItems": [
      {
        "id": "14012345678901",
        "name": "Cloud Hoodie - M / Sand",
        "productId": "8123456789012",
        "variantId": "45678901234567",
        "quantity": 1,
        "currentQuantity": 1,
        "price": 64,
        "totalDiscount": 6.4,
        "totalTax": 0,
        "properties": []
      }
    ],
    "shippingLines": [
      {
        "name": "Standard",
        "price": 5,
        "discountedPrice": 5
      }
    ],
    "shippingAddress": {
      "firstName": "Anna",
      "lastName": "Keller",
      "name": "Anna Keller",
      "company": null,
      "address1": "350 Fifth Avenue",
      "address2": "Apt 4B",
      "city": "New York",
      "province": "New York",
      "provinceCode": "NY",
      "zip": "10118",
      "country": "United States",
      "countryCode": "US",
      "phone": null
    },
    "customer": {
      "email": "anna@example.com",
      "name": "Anna Keller",
      "phone": null
    },
    "statuses": {
      "fulfillmentStatus": "FULFILLED",
      "financialStatus": "PAID",
      "deliveryStatus": "NOT_DELIVERED"
    },
    "fulfillments": [
      {
        "displayStatus": "OUT_FOR_DELIVERY",
        "deliveredAt": null,
        "trackingInfo": [
          {
            "company": "UPS",
            "url": "https://www.ups.com/track?tracknum=1Z999AA10123456784"
          }
        ]
      }
    ],
    "tags": []
  },
  "status": {
    "step": 3,
    "key": "outForDelivery",
    "currentStatusLabel": "Out for delivery",
    "timestamp": "2026-09-17T11:04:51.000Z",
    "steps": [
      {
        "key": "orderPlaced"
      }
    ]
  },
  "lineItemReviews": [
    {
      "productId": "8123456789012",
      "reviewId": null,
      "status": null,
      "url": "https://api.buildwithtoki.com/…"
    }
  ],
  "isReturnIntegrationEnabled": true,
  "isAppleWalletOrdersEnabled": true
}

reorder#

tokiWallet.reorder(orderId)→ Promise<{ checkoutUrl: string }>

Creates a checkout with the items of one of the customer's orders, for a Buy again button.

Toki creates a new Shopify cart with the order's items, quantities and line item properties, fills in the customer's email, and resolves to the cart's checkout URL. Paid memberships and custom items aren't included. The customer's current cart stays as it is: send them to checkoutUrl. Shopify stores only.

It rejects when Shopify can't create the cart, for example when a product from the order has been deleted.

Arguments

  • orderIdstringRequired

    Shopify's order ID, such as {{ order.id }} in Liquid.

Returns

Promise<{ checkoutUrl: string }>
  • checkoutUrlstring

    The checkout for the new cart, on your store's domain.

Example
const { checkoutUrl } = await tokiWallet.reorder(
  "5823749201234",
)
window.location.href = checkoutUrl
Result
{
  "checkoutUrl": "https://example.com/cart/c/Z2NwLXVzLWVhc3QxOjAxSkE4…?key=3c9f1a7e…"
}