---
title: "Create order"
method: POST
path: "/orders"
tags: ["Orders"]
---

# Create order

`POST /orders`

Creates a new order (products + amounts + customer data).

Minimum required fields:
- `currency`
- `line_items`
- `customer_info`

About `customer_info`:
- You can reference an existing customer using `customer_info.customer_id`, or
- You can provide customer details at minimum `customer_info.name` and `customer_info.email` to create the order with customer context.

How to create the order:
- Create an order only (no payment): send only the order data.
- Create an order and create the first payment charge: include `charges`.
- Create an order with a checkout configuration (for a hosted payment flow): include `checkout`.

Important rules:
- You cannot send `charges` and `checkout` in the same request (they are mutually exclusive).
- If you send `shipping_contact_id` and/or `fiscal_entity_id`, you must also send `customer_info.customer_id` so the API can validate those IDs against that customer.

## Headers

- `Accept-Language` 'es' | 'en'
- `X-Child-Company-Id` string

## Request body

- OrderRequest — a order
  - `currency` string, required — Currency with which the payment will be made.
  - `customer_info` union, required — Customer information
    - CustomerInfo
      - `customer_id` string
      - `name` string, required
      - `email` string, email, required
      - `phone` string
      - `corporate` boolean
    - CustomerInfoJustCustomerId
      - `customer_id` string, required
  - `line_items` Product[], required — List of [products](https://developers.digitalfemsa.io/reference/orderscreateproduct) that are sold in the order. You must have at least one product.
    - `name` string, required — The name of the item. It will be displayed in the order.
    - `unit_price` integer, required — The price of the item in cents.
    - `quantity` integer, required — The quantity of the item in the order.
    - `sku` string — The stock keeping unit for the item. It is used to identify the item in the order.
    - `brand` string — The brand of the item.
    - `description` string — Short description of the item
    - `tags` string[] — List of tags for the item. It is used to identify the item in the order.
    - `metadata` object — Arbitrary key-value data for your internal use. Keys should be strings; values can be any JSON value.
  - `charges` ChargeRequest[] — List of [charges](https://developers.digitalfemsa.io/reference/orderscreatecharge) that are applied to the order
    - `amount` integer
    - `payment_method` ChargeRequestPaymentMethod, required — Payment method used in the charge.
      - `expires_at` integer — Method expiration date as unix timestamp (applies to some payment methods, e.g. cash).
      - `type` string, required
      - `payment_source_id` string — Identifier of a saved payment source to be used for this charge (if applicable).
    - `reference_id` string — Custom reference to add to the charge
  - `checkout` CheckoutRequest — [Checkout](https://developers.digitalfemsa.io/docs/checkout-redireccionado) details
    - `allowed_payment_methods` string[], required — Are the payment methods available for this link
    - `expires_at` integer — Unix timestamp of checkout expiration
    - `failure_url` string — Redirection url back to the site in case of failed payment, applies only to HostedPayment.
    - `name` string — Reason for payment
    - `on_demand_enabled` boolean
    - `success_url` string — Redirection url back to the site in case of successful payment, applies only to HostedPayment
    - `type` string — This field represents the type of checkout
  - `discount_lines` OrderDiscountLinesRequest[] — List of [discounts](https://developers.digitalfemsa.io/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount.
    - `amount` integer, required — The amount to be deducted from the total sum of all payments, in cents.
    - `code` string, required — Discount code.
    - `type` string, required — It can be 'loyalty', 'campaign', 'coupon' o 'sign'
  - `tax_lines` OrderTaxRequest[] — List of [taxes](https://developers.digitalfemsa.io/reference/orderscreatetaxes) that are applied to the order.
    - `amount` integer, required — The amount to be collected for tax in cents
    - `description` string, required — description or tax's name
    - `metadata` object
  - `needs_shipping_contact` boolean — Allows you to fill out the shipping information at checkout
  - `shipping_contact` CustomerShippingContacts — [Shipping](https://developers.femsa.com/v2.1.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used.
    - `phone` string — Phone contact
    - `receiver` string — Name of the person who will receive the order
    - `between_streets` string — The street names between which the order will be delivered.
    - `address` CustomerShippingContactsAddress, required — Address of the person who will receive the order
      - `street1` string
      - `street2` string
      - `postal_code` string
      - `city` string
      - `state` string
      - `country` string — this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
      - `residential` boolean, nullable
    - `parent_id` string
    - `default` boolean, nullable
    - `deleted` boolean, nullable
    - `metadata` object — Metadata associated with the shipping contact
  - `shipping_lines` ShippingRequest[] — List of [shipping costs](https://developers.digitalfemsa.io/reference/orderscreateshipping). If the online store offers digital products.
    - `amount` integer, required — Shipping amount in cents
    - `carrier` string — Carrier name for the shipment
    - `tracking_number` string — Tracking number can be used to track the shipment
    - `method` string — Method of shipment
    - `description` string — Shipping line description
    - `metadata` object — Hash where the user can send additional information for each 'shipping'.
  - `fiscal_entity` OrderFiscalEntityRequest — Fiscal entity of the order, Currently it is a purely informative field
    - `address` FiscalEntityAddress, required — Address of the fiscal entity
      - `street1` string, required — Street name and number
      - `street2` string, nullable — Street name and number
      - `postal_code` string, required — Postal code
      - `city` string, required — City
      - `state` string — State
      - `country` string, required — this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
      - `external_number` string, required — External number
    - `email` string — Email of the fiscal entity
    - `metadata` object — Metadata associated with the fiscal entity
    - `name` string, nullable — Name of the fiscal entity
    - `phone` string — Phone of the fiscal entity
    - `tax_id` string, nullable — Tax ID of the fiscal entity
  - `processing_mode` string — Indicates the processing mode for the order, either ecommerce, recurrent or validation.
  - `metadata` object — Arbitrary key-value data that you can attach to the order for your internal use (e.g. `customer_segment`, `sales_channel`, `internal_order_id`). It is not used for payment processing or fraud decisions. Keys should be strings; values can be any JSON value.

## Response `200`

successful operation

## Other responses

- `401` — authentication error
- `402` — payment required error
- `422` — parameter validation error
- `500` — internal server error

---

[API](https://skmtc.dev/digitalfemsa/apis/femsa-api.md) · [All operations](https://skmtc.dev/digitalfemsa/apis/femsa-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/digitalfemsa/femsa-api/revisions/2e43caddf36b/schema)
