---
title: Orders
description: Place a meal order for a connected customer, take the payment with Stripe.js, and read orders and order events.
section: Meals
order: 4
---

# Orders

You will place an order for a connected customer, confirm the payment on your own page, and follow the order until it is paid and fulfilled.

Placing an order needs the `order:write` scope. Listing and reading orders needs `order:read`. The customer's connection must be `active` and carry `meals.orders`. See [Customers](/docs/meals/customers).

## Place an order

`POST /meals/v1/order/create/document` places an order to be delivered to an address on a delivery date. Take the vendor, product ids and delivery dates from the [Catalog](/docs/meals/catalog).

| Field                    | Required | Notes                                                                                                         |
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------- |
| `user`                   | Yes      | The customer id, as create answered it.                                                                       |
| `order_vendor`           | Yes      | The vendor id: letters, digits, hyphens and underscores, up to 200 characters.                                |
| `order_delivery_date`    | Yes      | `YYYY-MM-DD`, the date part of a `valid_delivery_dates` value. No time of day. Must be a day the zone offers. |
| `order_shipping_address` | Yes      | The address, with the limits below. `line2` is optional.                                                      |
| `line_items`             | Yes      | 1 to 50 objects with `line_item_product_id` and `line_quantity` (at least 1). A product can appear only once. |
| `order_contact_email`    | Yes      | The email the kitchen and the courier reach the customer at.                                                  |
| `order_contact_phone`    | Yes      | The phone number has its country code, such as `+14165550123`. At most 20 characters.                         |
| `order_customer_notes`   | No       | Notes for the kitchen, up to 500 characters.                                                                  |
| `reference`              | No       | Your own reference, 1 to 200 characters. See below.                                                           |
| `metadata`               | No       | Your own key-value data, at most 10 pairs of up to 100 characters. Returned as you sent it.                   |

The address (`OrderShippingAddressInput`) has these limits. A value that breaks one answers `422 validation_error` naming the field.

| Field         | Required | Limit                                                     |
| ------------- | -------- | --------------------------------------------------------- |
| `line1`       | Yes      | Up to 200 characters. `$`, `{` and `}` are not accepted.  |
| `line2`       | No       | Up to 200 characters. `$`, `{` and `}` are not accepted.  |
| `city`        | Yes      | Up to 100 characters. `$`, `{` and `}` are not accepted.  |
| `state`       | Yes      | The province: two letters, in capitals, such as `ON`.     |
| `postal_code` | Yes      | Letters, digits, spaces and hyphens, up to 20 characters. |
| `country`     | Yes      | Two letters, in capitals, such as `CA`.                   |

```bash
curl -X POST https://api.dev.nurishd.ca/meals/v1/order/create/document \
  -H "X-Partner-API-Key: $NURISHD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "user": "6f1c0d2e-0000-4000-8000-000000000101",
    "order_vendor": "vendor-harbour-kitchen",
    "order_delivery_date": "2026-04-07",
    "order_shipping_address": {
      "line1": "10 Example Street",
      "city": "Toronto",
      "state": "ON",
      "postal_code": "M5V 2T6",
      "country": "CA"
    },
    "line_items": [
      { "line_item_product_id": "product-salmon-bowl", "line_quantity": 4 },
      { "line_item_product_id": "product-chicken-wrap", "line_quantity": 2 }
    ],
    "order_contact_email": "ada.lovelace@example.com",
    "order_contact_phone": "+14165550123",
    "reference": "web-order-1001"
  }'
```

```javascript
const res = await fetch(
	'https://api.dev.nurishd.ca/meals/v1/order/create/document',
	{
		method: 'POST',
		headers: {
			'X-Partner-API-Key': process.env.NURISHD_API_KEY,
			'Content-Type': 'application/json',
		},
		body: JSON.stringify({
			user: '6f1c0d2e-0000-4000-8000-000000000101',
			order_vendor: 'vendor-harbour-kitchen',
			order_delivery_date: '2026-04-07',
			order_shipping_address: {
				line1: '10 Example Street',
				city: 'Toronto',
				state: 'ON',
				postal_code: 'M5V 2T6',
				country: 'CA',
			},
			line_items: [
				{
					line_item_product_id: 'product-salmon-bowl',
					line_quantity: 4,
				},
				{
					line_item_product_id: 'product-chicken-wrap',
					line_quantity: 2,
				},
			],
			order_contact_email: 'ada.lovelace@example.com',
			order_contact_phone: '+14165550123',
			reference: 'web-order-1001',
		}),
	},
);
const order = await res.json();
```

```python
import os
import requests

res = requests.post(
    "https://api.dev.nurishd.ca/meals/v1/order/create/document",
    headers={"X-Partner-API-Key": os.environ["NURISHD_API_KEY"]},
    json={
        "user": "6f1c0d2e-0000-4000-8000-000000000101",
        "order_vendor": "vendor-harbour-kitchen",
        "order_delivery_date": "2026-04-07",
        "order_shipping_address": {
            "line1": "10 Example Street",
            "city": "Toronto",
            "state": "ON",
            "postal_code": "M5V 2T6",
            "country": "CA",
        },
        "line_items": [
            {"line_item_product_id": "product-salmon-bowl", "line_quantity": 4},
            {"line_item_product_id": "product-chicken-wrap", "line_quantity": 2},
        ],
        "order_contact_email": "ada.lovelace@example.com",
        "order_contact_phone": "+14165550123",
        "reference": "web-order-1001",
    },
)
order = res.json()
```

The answer, with the fields trimmed to the ones you use first. Amounts are in cents.

```json
{
	"order_id": "ORD-ONE-OFF-4F7K2A9Q",
	"reference": "web-order-1001",
	"user": "6f1c0d2e-0000-4000-8000-000000000101",
	"order_vendor": {
		"vendor_id": "vendor-harbour-kitchen",
		"vendor_name": "Harbour Kitchen",
		"vendor_timezone": "America/Toronto"
	},
	"order_financial_status": "pending",
	"order_fulfillment_status": "pending payment",
	"order_delivery_status": "pending payment",
	"order_currency": "CAD",
	"order_total_price__BEFORE_TAX_DISCOUNT_AND_SHIPPING": 5980,
	"order_shipping_cost": 499,
	"order_tax_amount": 0,
	"order_discount_amount": 0,
	"order_total_price__AFTER_TAX_DISCOUNT_AND_SHIPPING": 6479,
	"order_delivery_date": "2026-04-07T04:00:00Z",
	"order_cutoff_date": "2026-04-04T19:30:00Z",
	"stripe_payment_intent": {
		"stripe_payment_intent_client_secret": "pi_example_secret_example",
		"stripe_payment_intent_status": "requires_payment_method"
	},
	"stripe_publishable_key": "pk_test_example",
	"order_created_at": "2026-04-01T15:04:05Z",
	"order_paid_at": null,
	"line_items": null
}
```

The order carries Nurish'd's own field names. `order_vendor` is the vendor as it was when the order was placed. `line_items` is `null` here and holds the items when you read one order. The three statuses use the internal values:

| Field                      | Values                                                                                                                           |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `order_financial_status`   | `draft`, `pending`, `failed payment`, `paid`, `cancelled`, `partially refunded`, `refunded`, `chargeback`.                       |
| `order_fulfillment_status` | `draft`, `pending payment`, `not started`, `preparing meals`, `partially completed`, `completed`, `cancelled`, `do not process`. |
| `order_delivery_status`    | `draft`, `pending payment`, `not yet shipped`, `shipped`, `delivered`, `delivery failed`, `cancelled`, `do not process`.         |

The amounts are `order_total_price__BEFORE_TAX_DISCOUNT_AND_SHIPPING` (the value of the line items), `order_shipping_cost`, `order_tax_amount`, `order_discount_amount` and `order_total_price__AFTER_TAX_DISCOUNT_AND_SHIPPING` (what the customer pays), all in `order_currency`. `order_service_charges` lists charges added after tax, and the total includes them.

Sending the same `reference` again returns the order already placed instead of a second one, so a retry after a timeout is safe. The reference, `metadata` and the key that placed the order are kept with the order. Nurish'd takes your company and key from the API key, never from the body.

> **Warning.** If the customer already started a cart for the same vendor, address zone and date in the Nurish'd app, that cart is emptied first, including any discount code or points on it.

## Take the payment

The customer's card pays. The order holds what your page needs:

| Field                                                       | Meaning                                                                                                                   |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `order_financial_status`                                    | The payment status.                                                                                                       |
| `stripe_payment_intent.stripe_payment_intent_client_secret` | The Stripe PaymentIntent client secret. Only while the payment is `pending`; otherwise `stripe_payment_intent` is `null`. |
| `stripe_payment_intent.stripe_payment_intent_status`        | The status of the Stripe PaymentIntent, for example `requires_payment_method`.                                            |
| `stripe_publishable_key`                                    | The Stripe publishable key. `null` until Stripe keys are configured.                                                      |

Confirm the payment on your own page with Stripe.js. This runs in the browser, never on your server. Send only the client secret and the publishable key to the page.

```javascript
// Runs in the browser, with Stripe.js loaded and a card element mounted.
const stripe = Stripe(publishableKey);
const { error, paymentIntent } = await stripe.confirmCardPayment(clientSecret, {
	payment_method: { card: cardElement },
});
```

> **Warning.** Do not treat the order as paid because your page says the card was accepted. The order is paid when `order_financial_status` is `paid` or the `order.paid` event arrives.

An order that costs nothing is paid at once and has `stripe_payment_intent` set to `null`. If the customer reloads before paying, `GET /meals/v1/order/{order_id}/get/document` returns the client secret again while the payment is `pending`.

> **Note.** How an order is paid is still provisional. The customer's card pays today. Who pays, the customer or your company on a statement, is not final.

## Order limits and delivery errors

Before anything is placed, the order is checked against the catalog, the vendor first. A vendor that does not exist, is not live, is archived or is not enabled for your company answers `404 not_found`. Then each failure answers `422` with its own code and creates nothing.

| Code                              | What it means for you                                                                                   |
| --------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `delivery_not_available`          | The vendor does not deliver to the address, or not on that date. Check the zone and the dates.          |
| `product_not_available`           | A product is not offered on that date, is not live, or cannot be ordered. Check the catalog.            |
| `order_limits_not_met`            | The order is below or above the vendor's limits on items or value. Change the items.                    |
| `vendor_not_allowed_for_customer` | The customer's account is limited to certain vendors and this is not one of them. Offer another vendor. |

Other answers:

- `404 not_found` for an unknown customer, or for a vendor that cannot be used (see above).
- `409 connection_not_active` while the customer has not approved the connection or after they revoked it.
- `409 order_conflict` when the order cannot be placed in its current state.

See [Errors](/docs/concepts/errors). None of these is safe to retry unchanged.

## List orders

`GET /meals/v1/order/query/documents` returns a page of the orders your company placed, newest first, without their line items. Orders of a customer whose connection is no longer active are left out.

| Parameter      | Meaning                                                                                                                |
| -------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `customer`     | Keep only the orders of this customer.                                                                                 |
| `vendor`       | Keep only the orders of this vendor.                                                                                   |
| `status`       | `pending`, `paid`, `fulfilled` or `canceled`. This is the stage this API records, not one of the three order statuses. |
| `from`, `to`   | Keep orders placed at or after, or at or before, this time (ISO 8601).                                                 |
| `page`, `size` | See [Pagination](/docs/concepts/pagination). `size` is at most 50.                                                     |

The stage behind `status` is updated when an order is read or when Nurish'd reports a change, so a list filter can lag behind until then.

```bash
curl "https://api.dev.nurishd.ca/meals/v1/order/query/documents?status=paid&size=10" \
  -H "X-Partner-API-Key: $NURISHD_API_KEY"
```

## Read an order

`GET /meals/v1/order/{order_id}/get/document` returns one order with its `line_items`, which are `null` in lists. Each line item has `line_item_product` (`product_id`, `product_name` and `product_price`, the product as it was when the order was placed), `line_item_quantity`, `line_item_fulfilled_quantity`, `line_item_financial_status`, `line_item_fulfillment_status`, `line_item_delivery_status` and `line_item_currency`.

An order that does not exist, or belongs to another company or environment, answers `404 not_found`. Once the customer revokes the connection it answers `409 connection_not_active`: you can no longer read their orders.

## Order events

| Event             | When                    |
| ----------------- | ----------------------- |
| `order.created`   | An order was created.   |
| `order.paid`      | An order was paid.      |
| `order.fulfilled` | An order was fulfilled. |
| `order.shipped`   | An order was shipped.   |
| `order.delivered` | An order was delivered. |
| `order.refunded`  | An order was refunded.  |
| `order.canceled`  | An order was canceled.  |

Order events carry the `order` id and the `customer` id, never a `patient`. They are the same ids as `order_id` and `user`. They need the `order:read` scope to be seen. See [Events](/docs/events/events).

`order.shipped` and `order.delivered` follow the order's `order_delivery_status`. `order.refunded` follows `order_financial_status` becoming `refunded` or `partially refunded`. An event can arrive late or in another order than it happened, so read the order for its present state. An order that was deleted before it was paid raises `order.canceled` and then answers `404 not_found` when you read it. The order list leaves it out.

## Next

- [Customers](/docs/meals/customers): connect a customer first.
- [Catalog](/docs/meals/catalog): vendors, products and delivery dates.
- [Events](/docs/events/events): react to order events.
