Generate Orders

Follow step-by-step instructions to create, clone, or calculate an order using the Square API.

In this lesson, we'll start our discussion on very useful APIs for processing orders provided by Square. Mainly, we'll explore the following three APIs:

CreateOrder
https://connect.squareupsandbox.com/v2/orders
CloneOrder
https://connect.squareupsandbox.com/v2/orders/clone
CalculateOrder
https://connect.squareupsandbox.com/v2/orders/calculate

The CreateOrder endpoint creates an order which includes information about the products and the settings to be applied to that purchase.

This endpoint requires an Order object as a request parameter. This object consists of several fields. Some important fields are described below:

Request Parameters

Parameter

Type

Category

Description

location_id

String

Required

This is the ID of the location this order is associated with.

reference_id

String

Optional

This is an ID specified by the client for associating an entity with this order in another system.

line_items

Object[ ]

Optional

It is an array of OrderLineItem objects representing different line items included in the order.

Each object contains the quantity, name, base_price_money, and total_money.

taxes

Object[ ]

Optional

It is an array of OrderLineItemTax objects representing all taxes associated with the order.

Each object contains the name, type, percentage, and several other fields.

discounts

Object[ ]

Optional

It is an array of OrderLineItemDiscount objects representing all discounts associated with the order.

Each object contains the name, type, percentage, amount_money, and several other fields.

In addition to the ...