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

You are viewing an old version of the API
Create payment link

POST /v2/online-checkout/payment-links

Creates a Square-hosted checkout page.

Applications can share the resulting payment link with their buyer to pay for goods and services.


Permissions
ORDERS_READ
ORDERS_WRITE
Guide
Checkout API Overview
Try in API Explorer
Name Description
idempotency_key
string

A unique string that identifies this CreatePaymentLinkRequest request. If you do not provide a unique string (or provide an empty string as the value), the endpoint treats each request as independent.

For more information, see Idempotency.

Max Length 192
description
string

A description of the payment link. You provide this optional description that is useful in your application context. It is not used anywhere.

Max Length 4096
quick_pay
QuickPay

Describes an ad hoc item and price for which to generate a quick pay checkout link. For more information, see Quick Pay Checkout.

order
Order

Describes the Order for which to create a checkout link. For more information, see Square Order Checkout.

checkout_options
CheckoutOptions

Describes optional fields to add to the resulting checkout page. For more information, see Optional Checkout Configurations.

pre_populated_data
PrePopulatedData

Describes fields to prepopulate in the resulting checkout page. For more information, see Prepopulate the shipping address.

source
string

The application that created the payment link.

payment_note
string

A note for the payment. After processing the payment, Square adds this note to the resulting Payment.

Max Length 500

Response Fields

Name Description
errors
Error [ ]

Any errors that occurred during the request.

payment_link
PaymentLink

The created payment link.

Examples

You are viewing an old version of the API
POST /v2/online-checkout/payment-links
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.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": "cd9e25dc-d9f2-4430-aedb-61605070e95f",
    "quick_pay": {
      "name": "Auto Detailing",
      "price_money": {
        "amount": 10000,
        "currency": "USD"
      },
      "location_id": "A9Y43N9ABXZBP"
    }
  }'
Response JSON
{
  "payment_link": {
    "id": "PKVT6XGJZXYUP3NZ",
    "version": 1,
    "order_id": "o4b7saqp4HzhNttf5AJxC0Srjd4F",
    "url": "https://square.link/u/EXAMPLE",
    "created_at": "2022-04-25T23:58:01Z"
  }
}