v1

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

CreatePaymentLink

Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services.

post/v2/online-checkout/payment-links

Request body

idempotency_keystring

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.

descriptionstring

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

payment_notestring

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

Example request

{
  "idempotency_key": "cd9e25dc-d9f2-4430-aedb-61605070e95f",
  "quick_pay": {
    "location_id": "A9Y43N9ABXZBP",
    "name": "Auto Detailing",
    "price_money": {
      "amount": 10000,
      "currency": "USD"
    }
  }
}

Response

Success

Example response

{
  "payment_link": {
    "created_at": "2022-04-25T23:58:01Z",
    "id": "PKVT6XGJZXYUP3NZ",
    "long_url": "https://checkout.square.site/EXAMPLE",
    "order_id": "o4b7saqp4HzhNttf5AJxC0Srjd4F",
    "url": "https://square.link/u/EXAMPLE",
    "version": 1
  },
  "related_resources": {
    "orders": [
      {
        "created_at": "2022-03-03T00:53:15.829Z",
        "fulfillments": [
          {
            "state": "PROPOSED",
            "type": "DIGITAL",
            "uid": "bBpNrxjdQxGQP16sTmdzi"
          }
        ],
        "id": "o4b7saqp4HzhNttf5AJxC0Srjd4F",
        "line_items": [
          {
            "base_price_money": {
              "amount": 12500,
              "currency": "USD"
            },
            "gross_sales_money": {
              "amount": 12500,
              "currency": "USD"
            },
            "item_type": "ITEM",
            "name": "Auto Detailing",
            "quantity": "1",
            "total_discount_money": {
              "amount": 0,
              "currency": "USD"
            },
            "total_money": {
              "amount": 12500,
              "currency": "USD"
            },
            "total_tax_money": {
              "amount": 0,
              "currency": "USD"
            },
            "uid": "8YX13D1U3jO7czP8JVrAR",
            "variation_total_price_money": {
              "amount": 12500,
              "currency": "USD"
            }
          }
        ],
        "location_id": "{LOCATION_ID}",
        "net_amounts": {
          "discount_money": {
            "amount": 0,
            "currency": "USD"
          },
          "service_charge_money": {
            "amount": 0,
            "currency": "USD"
          },
          "tax_money": {
            "amount": 0,
            "currency": "USD"
          },
          "tip_money": {
            "amount": 0,
            "currency": "USD"
          },
          "total_money": {
            "amount": 12500,
            "currency": "USD"
          }
        },
        "source": {
          "name": "Test Online Checkout Application"
        },
        "state": "DRAFT",
        "total_discount_money": {
          "amount": 0,
          "currency": "USD"
        },
        "total_money": {
          "amount": 12500,
          "currency": "USD"
        },
        "total_service_charge_money": {
          "amount": 0,
          "currency": "USD"
        },
        "total_tax_money": {
          "amount": 0,
          "currency": "USD"
        },
        "total_tip_money": {
          "amount": 0,
          "currency": "USD"
        },
        "updated_at": "2022-03-03T00:53:15.829Z",
        "version": 1
      }
    ]
  }
}