# PostOrders

From **Stripe API**.

`POST /v1/orders`

<p>Creates a new order object.</p>

## Request body

- Required: true
### `application/x-www-form-urlencoded`

- Type: `object`

```json
{"additionalProperties":false,"properties":{"coupon":{"description":"A coupon code that represents a discount to be applied to this order. Must be one-time duration and in same currency as the order. An order can have multiple coupons.","maxLength":5000,"type":"string"},"currency":{"description":"Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).","type":"string"},"customer":{"description":"The ID of an existing customer to use for this order. If provided, the customer email and shipping address will be used to create the order. Subsequently, the customer will also be charged to pay the order. If `email` or `shipping` are also provided, they will override the values retrieved from the customer object.","maxLength":5000,"type":"string"},"email":{"description":"The email address of the customer placing the order.","maxLength":5000,"type":"string"},"expand":{"description":"Specifies which fields in the response should be expanded.","items":{"maxLength":5000,"type":"string"},"type":"array"},"items":{"description":"List of items constituting the order. An order can have up to 25 items.","items":{"properties":{"amount":{"type":"integer"},"currency":{"type":"string"},"description":{"maxLength":1000,"type":"string"},"parent":{"maxLength":5000,"type":"string"},"quantity":{"type":"integer"},"type":{"enum":["discount","shipping","sku","tax"],"maxLength":5000,"type":"string"}},"title":"order_item_specs","type":"object"},"type":"array"},"metadata":{"additionalProperties":{"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.","type":"object"},"shipping":{"description":"Shipping address for the order. Required if any of the SKUs are for products that have `shippable` set to true.","properties":{"address":{"properties":{"city":{"maxLength":5000,"type":"string"},"country":{"maxLength":5000,"type":"string"},"line1":{"maxLength":5000,"type":"string"},"line2":{"maxLength":5000,"type":"string"},"postal_code":{"maxLength":5000,"type":"string"},"state":{"maxLength":5000,"type":"string"}},"title":"optional_fields_address","type":"object"},"name":{"maxLength":5000,"type":"string"},"phone":{"maxLength":5000,"type":"string"}},"required":["address","name"],"title":"customer_shipping","type":"object"}},"required":["currency"],"type":"object"}
```

## Security

### `basicAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `basic`
Send credentials in the `Authorization` request header using the `Basic` scheme.

Basic HTTP authentication. Allowed headers-- Authorization: Basic <api_key> | Authorization: Basic <base64 hash of `api_key:`>

### `bearerAuth`

- Type: `http`
- Request header: `Authorization`
- Scheme: `bearer`
- Bearer format: `auth-scheme`
Send the token in the `Authorization` request header using the `Bearer` scheme.

Bearer HTTP authentication. Allowed headers-- Authorization: Bearer <api_key>

## Responses

### `200`

Successful response.

### `application/json`

- Type: `object`

Order objects are created to handle end customers' purchases of previously
defined [products](https://stripe.com/docs/api#products). You can create, retrieve, and pay individual orders, as well
as list all orders. Orders are identified by a unique, random ID.

Related guide: [Tax, Shipping, and Inventory](https://stripe.com/docs/orders).

```json
{"description":"Order objects are created to handle end customers' purchases of previously\ndefined [products](https://stripe.com/docs/api#products). You can create, retrieve, and pay individual orders, as well\nas list all orders. Orders are identified by a unique, random ID.\n\nRelated guide: [Tax, Shipping, and Inventory](https://stripe.com/docs/orders).","properties":{"amount":{"description":"A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.","type":"integer"},"amount_returned":{"description":"The total amount that was returned to the customer.","nullable":true,"type":"integer"},"application":{"description":"ID of the Connect Application that created the order.","maxLength":5000,"nullable":true,"type":"string"},"application_fee":{"description":"A fee in cents that will be applied to the order and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation.","nullable":true,"type":"integer"},"charge":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/charge"}],"description":"The ID of the payment used to pay for the order. Present if the order status is `paid`, `fulfilled`, or `refunded`.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/charge"}]}},"created":{"description":"Time at which the object was created. Measured in seconds since the Unix epoch.","format":"unix-time","type":"integer"},"currency":{"description":"Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).","type":"string"},"customer":{"anyOf":[{"maxLength":5000,"type":"string"},{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}],"description":"The customer used for the order.","nullable":true,"x-expansionResources":{"oneOf":[{"$ref":"#/components/schemas/customer"},{"$ref":"#/components/schemas/deleted_customer"}]}},"email":{"description":"The email address of the customer placing the order.","maxLength":5000,"nullable":true,"type":"string"},"external_coupon_code":{"description":"External coupon code to load for this order.","maxLength":5000,"type":"string"},"id":{"description":"Unique identifier for the object.","maxLength":5000,"type":"string"},"items":{"description":"List of items constituting the order. An order can have up to 25 items.","items":{"$ref":"#/components/schemas/order_item"},"type":"array"},"livemode":{"description":"Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.","type":"boolean"},"metadata":{"additionalProperties":{"maxLength":500,"type":"string"},"description":"Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.","nullable":true,"type":"object"},"object":{"description":"String representing the object's type. Objects of the same type share the same value.","enum":["order"],"type":"string"},"returns":{"description":"A list of returns that have taken place for this order.","nullable":true,"properties":{"data":{"description":"Details about each object.","items":{"$ref":"#/components/schemas/order_return"},"type":"array"},"has_more":{"description":"True if this list has another page of items after this one that can be fetched.","type":"boolean"},"object":{"description":"String representing the object's type. Objects of the same type share the same value. Always has the value `list`.","enum":["list"],"type":"string"},"url":{"description":"The URL where this list can be accessed.","maxLength":5000,"type":"string"}},"required":["data","has_more","object","url"],"title":"OrdersResourceOrderReturnList","type":"object","x-expandableFields":["data"]},"selected_shipping_method":{"description":"The shipping method that is currently selected for this order, if any. If present, it is equal to one of the `id`s of shipping methods in the `shipping_methods` array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method.","maxLength":5000,"nullable":true,"type":"string"},"shipping":{"anyOf":[{"$ref":"#/components/schemas/shipping"}],"description":"The shipping address for the order. Present if the order is for goods to be shipped.","nullable":true},"shipping_methods":{"description":"A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it.","items":{"$ref":"#/components/schemas/shipping_method"},"nullable":true,"type":"array"},"status":{"description":"Current order status. One of `created`, `paid`, `canceled`, `fulfilled`, or `returned`. More details in the [Orders Guide](https://stripe.com/docs/orders/guide#understanding-order-statuses).","maxLength":5000,"type":"string"},"status_transitions":{"anyOf":[{"$ref":"#/components/schemas/status_transitions"}],"description":"The timestamps at which the order status was updated.","nullable":true},"updated":{"description":"Time at which the object was last updated. Measured in seconds since the Unix epoch.","format":"unix-time","nullable":true,"type":"integer"},"upstream_id":{"description":"The user's order ID if it is different from the Stripe order ID.","maxLength":5000,"type":"string"}},"required":["amount","created","currency","id","items","livemode","object","status"],"title":"Order","type":"object","x-expandableFields":["charge","customer","items","returns","shipping","shipping_methods","status_transitions"],"x-resourceId":"order"}
```

### `default`

Error response.

### `application/json`

- Type: `object`

An error response from the Stripe API

```json
{"description":"An error response from the Stripe API","properties":{"error":{"$ref":"#/components/schemas/api_errors"}},"required":["error"],"type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url https://api.stripe.com/v1/orders \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data '{
  "coupon": "string",
  "currency": "string",
  "customer": "string",
  "email": "string",
  "expand": [
    "string"
  ],
  "items": [
    {
      "amount": 1,
      "currency": "string",
      "description": "string",
      "parent": "string",
      "quantity": 1,
      "type": "string"
    }
  ],
  "metadata": {},
  "shipping": {
    "address": {
      "city": "string",
      "country": "string",
      "line1": "string",
      "line2": "string",
      "postal_code": "string",
      "state": "string"
    },
    "name": "string",
    "phone": "string"
  }
}'
```
