v1

latestOpenAPI 3.0.0Apache 2.02026-07-143281,4552.1 MB
Checkout

CreateCheckout

Links a checkoutId to a checkout_page_url that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.

NOTE: The Checkout API has been updated with new features. For more information, see Checkout API highlights.

post/v2/locations/{location_id}/checkouts

Path parameters

location_idstring required

The ID of the business location to associate the checkout with.

Request body

idempotency_keystring required

A unique string that identifies this checkout among others you have created. It can be any valid string but must be unique for every order sent to Square Checkout for a given location ID.

The idempotency key is used to avoid processing the same order more than once. If you are unsure whether a particular checkout was created successfully, you can attempt it again with the same idempotency key and all the same other parameters without worrying about creating duplicates.

You should use a random number/string generator native to the language you are working in to generate strings for your idempotency keys.

For more information, see Idempotency.

ask_for_shipping_addressboolean

If true, Square Checkout collects shipping information on your behalf and stores that information with the transaction information in the Square Seller Dashboard.

Default: false.

merchant_support_emailstring

The email address to display on the Square Checkout confirmation page and confirmation email that the buyer can use to contact the seller.

If this value is not set, the confirmation page and email display the primary email address associated with the seller's Square account.

Default: none; only exists if explicitly set.

pre_populate_buyer_emailstring

If provided, the buyer's email is prepopulated on the checkout page as an editable text field.

Default: none; only exists if explicitly set.

redirect_urlstring

The URL to redirect to after the checkout is completed with checkoutId, transactionId, and referenceId appended as URL parameters. For example, if the provided redirect URL is http://www.example.com/order-complete, a successful transaction redirects the customer to:

http://www.example.com/order-complete?checkoutId=xxxxxx&referenceId=xxxxxx&transactionId=xxxxxx

If you do not provide a redirect URL, Square Checkout displays an order confirmation page on your behalf; however, it is strongly recommended that you provide a redirect URL so you can verify the transaction results and finalize the order through your existing/normal confirmation workflow.

Default: none; only exists if explicitly set.

notestring

An optional note to associate with the checkout object.

This value cannot exceed 60 characters.

Example request

{
  "additional_recipients": [
    {
      "amount_money": {
        "amount": 60,
        "currency": "USD"
      },
      "description": "Application fees",
      "location_id": "057P5VYJ4A5X1"
    }
  ],
  "ask_for_shipping_address": true,
  "idempotency_key": "86ae1696-b1e3-4328-af6d-f1e04d947ad6",
  "merchant_support_email": "merchant+support@website.com",
  "order": {
    "idempotency_key": "12ae1696-z1e3-4328-af6d-f1e04d947gd4",
    "order": {
      "customer_id": "customer_id",
      "discounts": [
        {
          "amount_money": {
            "amount": 100,
            "currency": "USD"
          },
          "scope": "LINE_ITEM",
          "type": "FIXED_AMOUNT",
          "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
        }
      ],
      "line_items": [
        {
          "applied_discounts": [
            {
              "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
            }
          ],
          "applied_taxes": [
            {
              "tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
            }
          ],
          "base_price_money": {
            "amount": 1500,
            "currency": "USD"
          },
          "name": "Printed T Shirt",
          "quantity": "2"
        },
        {
          "base_price_money": {
            "amount": 2500,
            "currency": "USD"
          },
          "name": "Slim Jeans",
          "quantity": "1"
        },
        {
          "base_price_money": {
            "amount": 3500,
            "currency": "USD"
          },
          "name": "Woven Sweater",
          "quantity": "3"
        }
      ],
      "location_id": "location_id",
      "reference_id": "reference_id",
      "taxes": [
        {
          "percentage": "7.75",
          "scope": "LINE_ITEM",
          "type": "INCLUSIVE",
          "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
        }
      ]
    }
  },
  "pre_populate_buyer_email": "example@email.com",
  "pre_populate_shipping_address": {
    "address_line_1": "1455 Market St.",
    "address_line_2": "Suite 600",
    "administrative_district_level_1": "CA",
    "country": "US",
    "first_name": "Jane",
    "last_name": "Doe",
    "locality": "San Francisco",
    "postal_code": "94103"
  },
  "redirect_url": "https://merchant.website.com/order-confirm"
}

Response

Success

Example response

{
  "checkout": {
    "additional_recipients": [
      {
        "amount_money": {
          "amount": 60,
          "currency": "USD"
        },
        "description": "Application fees",
        "location_id": "057P5VYJ4A5X1"
      }
    ],
    "ask_for_shipping_address": true,
    "checkout_page_url": "https://connect.squareup.com/v2/checkout?c=CAISEHGimXh-C3RIT4og1a6u1qw&l=CYTKRM7R7JMV8",
    "created_at": "2017-06-16T22:25:35Z",
    "id": "CAISEHGimXh-C3RIT4og1a6u1qw",
    "merchant_support_email": "merchant+support@website.com",
    "order": {
      "customer_id": "customer_id",
      "discounts": [
        {
          "amount_money": {
            "amount": 100,
            "currency": "USD"
          },
          "applied_money": {
            "amount": 100,
            "currency": "USD"
          },
          "scope": "LINE_ITEM",
          "type": "FIXED_AMOUNT",
          "uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
        }
      ],
      "line_items": [
        {
          "applied_discounts": [
            {
              "applied_money": {
                "amount": 100,
                "currency": "USD"
              },
              "discount_uid": "56ae1696-z1e3-9328-af6d-f1e04d947gd4"
            }
          ],
          "applied_taxes": [
            {
              "applied_money": {
                "amount": 103,
                "currency": "USD"
              },
              "tax_uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
            }
          ],
          "base_price_money": {
            "amount": 1500,
            "currency": "USD"
          },
          "name": "Printed T Shirt",
          "quantity": "2",
          "total_discount_money": {
            "amount": 100,
            "currency": "USD"
          },
          "total_money": {
            "amount": 1503,
            "currency": "USD"
          },
          "total_tax_money": {
            "amount": 103,
            "currency": "USD"
          }
        },
        {
          "base_price_money": {
            "amount": 2500,
            "currency": "USD"
          },
          "name": "Slim Jeans",
          "quantity": "1",
          "total_money": {
            "amount": 2500,
            "currency": "USD"
          }
        },
        {
          "base_price_money": {
            "amount": 3500,
            "currency": "USD"
          },
          "name": "Woven Sweater",
          "quantity": "3",
          "total_money": {
            "amount": 10500,
            "currency": "USD"
          }
        }
      ],
      "location_id": "location_id",
      "reference_id": "reference_id",
      "taxes": [
        {
          "percentage": "7.75",
          "scope": "LINE_ITEM",
          "type": "INCLUSIVE",
          "uid": "38ze1696-z1e3-5628-af6d-f1e04d947fg3"
        }
      ],
      "total_discount_money": {
        "amount": 100,
        "currency": "USD"
      },
      "total_money": {
        "amount": 14503,
        "currency": "USD"
      },
      "total_tax_money": {
        "amount": 103,
        "currency": "USD"
      }
    },
    "pre_populate_buyer_email": "example@email.com",
    "pre_populate_shipping_address": {
      "address_line_1": "1455 Market St.",
      "address_line_2": "Suite 600",
      "administrative_district_level_1": "CA",
      "country": "US",
      "first_name": "Jane",
      "last_name": "Doe",
      "locality": "San Francisco",
      "postal_code": "94103"
    },
    "redirect_url": "https://merchant.website.com/order-confirm",
    "version": 1
  }
}