• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Create order

POST /v2/orders

Creates a new order that can include information about products for purchase and settings to apply to the purchase.

To pay for a created order, see Pay for Orders.

You can modify open orders using the UpdateOrder endpoint.


Permissions
ORDERS_WRITE
Guide
Create Orders
Try in API Explorer
Name Description
order
Order

The order to create. If this field is set, the only other top-level field that can be set is the idempotency_key.

idempotency_key
string

A value you specify that uniquely identifies this order among orders you have created.

If you are unsure whether a particular order was created successfully, you can try it again with the same idempotency key without worrying about creating duplicate orders.

For more information, see Idempotency.

Max Length 192

Response Fields

Name Description
order
Order

The newly created order.

errors
Error [ ]

Any errors that occurred during the request.

Examples

You are viewing an old version of the API
POST /v2/orders
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/orders \
  -X POST \
  -H 'Square-Version: 2021-07-21' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "8193148c-9586-11e6-99f9-28cfe92138cf",
    "order": {
      "reference_id": "my-order-001",
      "location_id": "057P5VYJ4A5X1",
      "line_items": [
        {
          "name": "New York Strip Steak",
          "quantity": "1",
          "base_price_money": {
            "amount": 1599,
            "currency": "USD"
          }
        },
        {
          "quantity": "2",
          "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
          "modifiers": [
            {
              "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ"
            }
          ],
          "applied_discounts": [
            {
              "discount_uid": "one-dollar-off"
            }
          ]
        }
      ],
      "taxes": [
        {
          "uid": "state-sales-tax",
          "name": "State Sales Tax",
          "percentage": "9",
          "scope": "ORDER"
        }
      ],
      "discounts": [
        {
          "uid": "labor-day-sale",
          "name": "Labor Day Sale",
          "percentage": "5",
          "scope": "ORDER"
        },
        {
          "uid": "membership-discount",
          "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
          "scope": "ORDER"
        },
        {
          "uid": "one-dollar-off",
          "name": "Sale - $1.00 off",
          "amount_money": {
            "amount": 100,
            "currency": "USD"
          },
          "scope": "LINE_ITEM"
        }
      ]
    }
  }'
Response JSON
{
  "order": {
    "id": "CAISENgvlJ6jLWAzERDzjyHVybY",
    "location_id": "057P5VYJ4A5X1",
    "line_items": [
      {
        "uid": "8uSwfzvUImn3IRrvciqlXC",
        "name": "New York Strip Steak",
        "quantity": "1",
        "applied_taxes": [
          {
            "uid": "aKG87ArnDpvMLSZJHxWUl",
            "tax_uid": "state-sales-tax",
            "applied_money": {
              "amount": 136,
              "currency": "USD"
            }
          }
        ],
        "applied_discounts": [
          {
            "uid": "jWdgP1TpHPFBuVrz81mXVC",
            "discount_uid": "membership-discount",
            "applied_money": {
              "amount": 8,
              "currency": "USD"
            }
          },
          {
            "uid": "jnZOjjVY57eRcQAVgEwFuC",
            "discount_uid": "labor-day-sale",
            "applied_money": {
              "amount": 79,
              "currency": "USD"
            }
          }
        ],
        "base_price_money": {
          "amount": 1599,
          "currency": "USD"
        },
        "gross_sales_money": {
          "amount": 1599,
          "currency": "USD"
        },
        "total_tax_money": {
          "amount": 136,
          "currency": "USD"
        },
        "total_discount_money": {
          "amount": 87,
          "currency": "USD"
        },
        "total_money": {
          "amount": 1648,
          "currency": "USD"
        },
        "variation_total_price_money": {
          "amount": 1599,
          "currency": "USD"
        }
      },
      {
        "uid": "v8ZuEXpOJpb0bazLuvrLDB",
        "name": "New York Steak",
        "quantity": "2",
        "catalog_object_id": "BEMYCSMIJL46OCDV4KYIKXIB",
        "variation_name": "Larger",
        "modifiers": [
          {
            "uid": "Lo3qMMckDluu9Qsb58d4CC",
            "catalog_object_id": "CHQX7Y4KY6N5KINJKZCFURPZ",
            "name": "Well",
            "base_price_money": {
              "amount": 50,
              "currency": "USD"
            },
            "total_price_money": {
              "amount": 100,
              "currency": "USD"
            }
          }
        ],
        "applied_taxes": [
          {
            "uid": "v1dAgrfUVUPTnVTf9sRPz",
            "tax_uid": "state-sales-tax",
            "applied_money": {
              "amount": 374,
              "currency": "USD"
            }
          }
        ],
        "applied_discounts": [
          {
            "uid": "nUXvdsIItfKko0dbYtY58C",
            "discount_uid": "membership-discount",
            "applied_money": {
              "amount": 22,
              "currency": "USD"
            }
          },
          {
            "uid": "qSdkOOOernlVQqsJ94SPjB",
            "discount_uid": "labor-day-sale",
            "applied_money": {
              "amount": 224,
              "currency": "USD"
            }
          },
          {
            "uid": "y7bVl4njrWAnfDwmz19izB",
            "discount_uid": "one-dollar-off",
            "applied_money": {
              "amount": 100,
              "currency": "USD"
            }
          }
        ],
        "base_price_money": {
          "amount": 2200,
          "currency": "USD"
        },
        "gross_sales_money": {
          "amount": 4500,
          "currency": "USD"
        },
        "total_tax_money": {
          "amount": 374,
          "currency": "USD"
        },
        "total_discount_money": {
          "amount": 346,
          "currency": "USD"
        },
        "total_money": {
          "amount": 4528,
          "currency": "USD"
        },
        "variation_total_price_money": {
          "amount": 4400,
          "currency": "USD"
        }
      }
    ],
    "taxes": [
      {
        "uid": "state-sales-tax",
        "name": "State Sales Tax",
        "type": "ADDITIVE",
        "percentage": "9",
        "applied_money": {
          "amount": 510,
          "currency": "USD"
        },
        "scope": "ORDER"
      }
    ],
    "discounts": [
      {
        "uid": "membership-discount",
        "catalog_object_id": "DB7L55ZH2BGWI4H23ULIWOQ7",
        "name": "Membership Discount",
        "type": "FIXED_PERCENTAGE",
        "percentage": "0.5",
        "applied_money": {
          "amount": 30,
          "currency": "USD"
        },
        "scope": "ORDER"
      },
      {
        "uid": "labor-day-sale",
        "name": "Labor Day Sale",
        "type": "FIXED_PERCENTAGE",
        "percentage": "5",
        "applied_money": {
          "amount": 303,
          "currency": "USD"
        },
        "scope": "ORDER"
      },
      {
        "uid": "one-dollar-off",
        "name": "Sale - $1.00 off",
        "type": "FIXED_AMOUNT",
        "amount_money": {
          "amount": 100,
          "currency": "USD"
        },
        "applied_money": {
          "amount": 100,
          "currency": "USD"
        },
        "scope": "LINE_ITEM"
      }
    ],
    "created_at": "2020-01-17T20:47:53.293Z",
    "updated_at": "2020-01-17T20:47:53.293Z",
    "state": "OPEN",
    "version": 1,
    "reference_id": "my-order-001",
    "total_money": {
      "amount": 6176,
      "currency": "USD"
    },
    "total_tax_money": {
      "amount": 510,
      "currency": "USD"
    },
    "total_discount_money": {
      "amount": 433,
      "currency": "USD"
    },
    "total_tip_money": {
      "amount": 0,
      "currency": "USD"
    },
    "total_service_charge_money": {
      "amount": 0,
      "currency": "USD"
    },
    "net_amounts": {
      "total_money": {
        "amount": 6176,
        "currency": "USD"
      },
      "tax_money": {
        "amount": 510,
        "currency": "USD"
      },
      "discount_money": {
        "amount": 433,
        "currency": "USD"
      },
      "tip_money": {
        "amount": 0,
        "currency": "USD"
      },
      "service_charge_money": {
        "amount": 0,
        "currency": "USD"
      }
    },
    "source": {
      "name": "My App"
    }
  }
}

Share feedback

Thanks for visiting the Square API documentation. What's on your mind?