Skip to content
Navigation

Create an order

Unipage creates the customer, validates everything again (slot and capacity, products orderable and in stock, option rules, delivery zone and minimum, coupon) and places the order. An invalid coupon is a 422 COUPON_INVALID, never silently dropped.

paymentType picks who collects the money (see Payments):

  • online: Unipage, with the restaurant's payment provider. The order is PENDING_PAYMENT and next.type is payment: send the shopper's browser to next.url. After the payment they are sent to returnUrl with ?status=success (or ?status=failed for a failed or cancelled payment). Read the outcome from GET /orders/{id} (isPaid, status), never from the query string.
  • offline: the restaurant, at pickup or on delivery. The order is PLACED and unpaid.
  • external: you, with your own payment provider, before you place the order. The order is PLACED and paid at once.

With customerNotifications: false, Unipage sends the customer no mail, SMS or push message for this order, now or later: you send your own. See Customer messages.

POST
https://api.unipage.eu/storefront/v1/orders

Authorization

  • secretKey
    HTTP
    required

Request body JSON required

  • orderType
    TAKEOUT
    or
    DELIVERY
    required
  • slotAt
    integer
    required

    Unix seconds of the chosen slot, from the schedule.

  • lines
    array of
    object
    required
    • productId
      string
      required
    • quantity
      integer
      required
      minimum: 1
    • notes
      optional
      string
      maxLength: 255
    • options
      optional
      array of
      object
      • groupId
        string
        required
      • optionId
        string
        required
      • quantity
        optional
        integer

        Only matters for AMOUNT groups.

        default: 1
  • customer
    object
    required

    Unipage finds or creates the restaurant's customer by e-mail address.

    • firstName
      string
      required
      maxLength: 255
    • lastName
      string
      required
      maxLength: 255
    • email
      string
      required
      format: email · maxLength: 255
    • phone
      string
      required

      6 to 20 digits, spaces and + ( ) . / -.

  • paymentType
    online
    or
    offline
    or
    external
    required

    online or offline: one of the restaurant's payment.methods. external: you took the payment yourself; always accepted. See Payments.

  • delivery
    optional
    object

    Required for DELIVERY (every field), ignored for TAKEOUT.

    • zoneId
      optional
      string

      A zone id from GET /store.

    • street
      optional
      string
      maxLength: 255
    • number
      optional
      string
      maxLength: 50
    • postcode
      optional
      string
      maxLength: 20
    • city
      optional
      string
      maxLength: 255
  • payment
    optional
    object

    Only for external: where you took the payment, kept on the order for reconciliation.

    • provider
      optional
      string
      maxLength: 50
    • reference
      optional
      string
      maxLength: 255
  • customerNotifications
    optional
    boolean

    false: Unipage sends the customer nothing for this order (no confirmation, status or review message, by mail, SMS or push), now or later. The restaurant's own notifications are not affected. See Customer messages.

    default: true
  • notes
    optional
    string

    Only shown to the restaurant when notesEnabled is true.

    maxLength: 1000
  • coupon
    optional
    string | null
  • locale
    optional
    nl
    or
    fr
    or
    en
    or
    de
    or
    es

    Default the restaurant language. Mails, SMS and the order label follow it.

  • returnUrl
    optional
    string

    Where the shopper lands after an online payment, with ?status=success or ?status=failed added. {orderId} is replaced by the order id. It must be on one of the origins of your storefront's public key or on a local origin (localhost, 127.0.0.1, [::1]), otherwise 422 VALIDATION (fields.returnUrl). Without it, the shopper lands on the restaurant's own Unipage thank-you page.

    maxLength: 2000

Returns

201

The order was placed.

JSON
  • order
    optional
    object
    • id
      optional
      string
    • status
      optional
      PENDING_PLACEMENT
      or
      PENDING_PAYMENT
      or
      PAYMENT_FAILED
      or
      PLACED
      or
      CHEF_STARTED
      or
      CHEF_COMPLETED
      +2 more
      • PENDING_PAYMENT: an online order, until the payment provider confirms.
      • PAYMENT_FAILED: the online payment failed or was cancelled.
      • PLACED: the restaurant received the order (offline, external, or a confirmed payment).
      • CHEF_STARTED: the restaurant started preparing it.
      • CHEF_COMPLETED: ready for pickup or out for delivery.
      • DECLINED, CANCELED: the restaurant refused or cancelled it.
      • PENDING_PLACEMENT: being placed; you will rarely see it.

      New statuses may be added: treat an unknown one as "in progress".

    • label
      optional
      string

      The status in the order's locale.

    • orderType
      optional
      TAKEOUT
      or
      DELIVERY
    • slotAt
      optional
      integer
    • paymentType
      optional
      online
      or
      offline
      or
      external
    • isPaid
      optional
      boolean

      Read the payment outcome from this, never from the return URL.

    • customerNotifications
      optional
      boolean

      false when Unipage sends the customer nothing for this order.

    • lines
      optional
      array of
      object

      Includes the restaurant's charges as lines with productId: null.

      • productId
        optional
        string | null
      • name
        optional
        string
      • quantity
        optional
        integer
      • optionsLabel
        optional
        string
      • total
        optional
        number
    • subtotal
      optional
      number
    • deliveryCost
      optional
      number
    • serviceCost
      optional
      number
    • couponDiscount
      optional
      number

      Every reduction (coupon, promotional offer).

    • total
      optional
      number
    • currency
      optional
      string
    • locale
      optional
      string
    • customer
      optional
      object
      • firstName
        optional
        string
      • lastName
        optional
        string
      • email
        optional
        string
    • delivery
      optional
      object | null

      For DELIVERY orders, else null.

      • street
        optional
        string
      • number
        optional
        string
      • postcode
        optional
        string
      • city
        optional
        string
      • zone
        optional
        string
    • createdAt
      optional
      integer

      Unix seconds.

  • next
    optional
    object

    What to do with the shopper next.

    • type
      optional
      payment
      or
      confirmation

      payment (online): send the shopper's browser to next.url. confirmation (offline, external): the order is placed, nothing is left to pay through Unipage.

    • url
      optional
      string

      Only for payment. The payment page on the restaurant's Unipage webshop domain. Treat it as opaque: send the browser to it as is.

401

A missing, unknown or revoked key (UNAUTHENTICATED).
JSON
  • error
    object
    required
    • code
      UNAUTHENTICATED
      or
      FORBIDDEN
      or
      NOT_FOUND
      or
      METHOD_NOT_ALLOWED
      or
      VALIDATION
      or
      SLOT_UNAVAILABLE
      +6 more
      required
    • message
      string
      required

      Human readable.

    • fields
      optional
      map of
      string

      Only present when the error belongs to specific request fields.

403

A public key on a secret route, or used from an origin that is not registered for it (FORBIDDEN).
JSON
  • error
    object
    required
    • code
      UNAUTHENTICATED
      or
      FORBIDDEN
      or
      NOT_FOUND
      or
      METHOD_NOT_ALLOWED
      or
      VALIDATION
      or
      SLOT_UNAVAILABLE
      +6 more
      required
    • message
      string
      required

      Human readable.

    • fields
      optional
      map of
      string

      Only present when the error belongs to specific request fields.

422

The order cannot be placed. code is one of VALIDATION, SLOT_UNAVAILABLE, DELIVERY_UNAVAILABLE, PRODUCT_UNAVAILABLE, COUPON_INVALID or MINIMUM_NOT_REACHED.
JSON
  • error
    object
    required
    • code
      UNAUTHENTICATED
      or
      FORBIDDEN
      or
      NOT_FOUND
      or
      METHOD_NOT_ALLOWED
      or
      VALIDATION
      or
      SLOT_UNAVAILABLE
      +6 more
      required
    • message
      string
      required

      Human readable.

    • fields
      optional
      map of
      string

      Only present when the error belongs to specific request fields.

429

Too many requests (RATE_LIMITED). Wait Retry-After seconds.
JSON
  • error
    object
    required
    • code
      UNAUTHENTICATED
      or
      FORBIDDEN
      or
      NOT_FOUND
      or
      METHOD_NOT_ALLOWED
      or
      VALIDATION
      or
      SLOT_UNAVAILABLE
      +6 more
      required
    • message
      string
      required

      Human readable.

    • fields
      optional
      map of
      string

      Only present when the error belongs to specific request fields.

Type to search…

↑↓ navigate↵ selectEsc close