Developers

Search the docs

Search guides and headings.

Orders

Place a meal order for a connected customer, take the payment with Stripe.js, and read orders and order events.

View as Markdown

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.

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.

FieldRequiredNotes
userYesThe customer id, as create answered it.
order_vendorYesThe vendor id: letters, digits, hyphens and underscores, up to 200 characters.
order_delivery_dateYesYYYY-MM-DD, the date part of a valid_delivery_dates value. No time of day. Must be a day the zone offers.
order_shipping_addressYesThe address, with the limits below. line2 is optional.
line_itemsYes1 to 50 objects with line_item_product_id and line_quantity (at least 1). A product can appear only once.
order_contact_emailYesThe email the kitchen and the courier reach the customer at.
order_contact_phoneYesThe phone number has its country code, such as +14165550123. At most 20 characters.
order_customer_notesNoNotes for the kitchen, up to 500 characters.
referenceNoYour own reference, 1 to 200 characters. See below.
metadataNoYour 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.

FieldRequiredLimit
line1YesUp to 200 characters. $, { and } are not accepted.
line2NoUp to 200 characters. $, { and } are not accepted.
cityYesUp to 100 characters. $, { and } are not accepted.
stateYesThe province: two letters, in capitals, such as ON.
postal_codeYesLetters, digits, spaces and hyphens, up to 20 characters.
countryYesTwo 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"
  }'

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:

FieldValues
order_financial_statusdraft, pending, failed payment, paid, cancelled, partially refunded, refunded, chargeback.
order_fulfillment_statusdraft, pending payment, not started, preparing meals, partially completed, completed, cancelled, do not process.
order_delivery_statusdraft, 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.

Take the payment#

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

FieldMeaning
order_financial_statusThe payment status.
stripe_payment_intent.stripe_payment_intent_client_secretThe Stripe PaymentIntent client secret. Only while the payment is pending; otherwise stripe_payment_intent is null.
stripe_payment_intent.stripe_payment_intent_statusThe status of the Stripe PaymentIntent, for example requires_payment_method.
stripe_publishable_keyThe 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 },
});

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.

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.

CodeWhat it means for you
delivery_not_availableThe vendor does not deliver to the address, or not on that date. Check the zone and the dates.
product_not_availableA product is not offered on that date, is not live, or cannot be ordered. Check the catalog.
order_limits_not_metThe order is below or above the vendor's limits on items or value. Change the items.
vendor_not_allowed_for_customerThe 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. 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.

ParameterMeaning
customerKeep only the orders of this customer.
vendorKeep only the orders of this vendor.
statuspending, paid, fulfilled or canceled. This is the stage this API records, not one of the three order statuses.
from, toKeep orders placed at or after, or at or before, this time (ISO 8601).
page, sizeSee 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#

EventWhen
order.createdAn order was created.
order.paidAn order was paid.
order.fulfilledAn order was fulfilled.
order.shippedAn order was shipped.
order.deliveredAn order was delivered.
order.refundedAn order was refunded.
order.canceledAn 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.

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: connect a customer first.
  • Catalog: vendors, products and delivery dates.
  • Events: react to order events.