Learn how to create a checkout link for a Square order.
Checkout API

Square Order Checkout

An application can generate a checkout page by specifying an order in a CreatePaymentLink request (see Checkout API Overview). The following example request specifies an Order object. For simplicity, the example specifies four ad hoc line items. You can also use catalog items. For more information, see Create Orders.

Create Payment Link
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
curl https://connect.squareupsandbox.com/v2/online-checkout/payment-links \
  -X POST \
  -H 'Square-Version: 2022-06-16' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "{UNIQUE_KEY}",
    "order": {
      "location_id": "{LOCATION_ID}",
      "line_items": [
        {
          "name": "60,000 mile maintenance",
          "quantity": "1",
          "base_price_money": {
            "amount": 30000,
            "currency": "USD"
          },
          "note": "1st line item note"
        },
        {
          "name": "Tire rotation and balancing",
          "quantity": "1",
          "base_price_money": {
            "amount": 15000,
            "currency": "USD"
          }
        },
        {
          "name": "Wiper fluid replacement",
          "quantity": "1",
          "base_price_money": {
            "amount": 1900,
            "currency": "USD"
          }
        },
        {
          "name": "Oil change",
          "quantity": "1",
          "base_price_money": {
            "amount": 2000,
            "currency": "USD"
          }
        }
      ]
    }
  }'

After receiving the requests, Square creates an order, creates a checkout page, and returns the order_id and URL to the checkout page in the response. The following is an example response:

Applications can use the order ID to access the order details using the Orders API (RetrieveOrder endpoint).

The application can send the payment link to the buyer. The buyer experience is identical to what is described in Quick Pay Checkout.

Related topics Permalink Get a link to this section

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.