Applies to:
Learn how to update, retrieve, and delete the checkout pages you created.
You can use the payment_link
fields:
description
- The optional description of thepayment_link
object.checkout_options
- You should specify the entireCheckoutOptions object in the update request. If you specify only specific fields, the update operation deletes fields not included in the request.pre_populated_data
- You only specify thePrePopulatedData fields that you want to update (or add). If a field you provided in the request doesn't exist, it gets added.
You cannot update the order_id
, version
, URL
, or timestamp
fields.
In the following example, you create a checkout page and then call
Create a quick pay checkout page for $125 for auto detailing:
Create payment link
curl https://connect.squareupsandbox.com/v2/online-checkout/payment-links \ -X POST \ -H 'Square-Version: 2025-03-19' \ -H 'Authorization: Bearer {ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -d '{ "idempotency_key": "{UNIQUE_KEY}", "quick_pay": { "name": "Auto Detailing", "price_money": { "amount": 12500, "currency": "USD" }, "location_id": "{LOCATION_ID}" }, "pre_populated_data": { "buyer_email": "buyer@email.com", "buyer_phone_number": "1-415-555-1212", "buyer_address": { "address_line_1": "1455 MARKET ST #600", "country": "US", "administrative_district_level_1": "CA", "locality": "San Jose", "postal_code": "94103" } }, "checkout_options": { "allow_tipping": true, "ask_for_shipping_address": true, "custom_fields": [ { "title": "Special Instructions" }, { "title": "Would you like to be on mailing list" } ] } }'The following is an example response:
{ "payment_link": { "id": "OTKXE56AZGRBPAN4", "version": 1, "order_id": "m1rS3y9B95BWRTVJVs9K3iJD4yLZY", "checkout_options": { "allow_tipping": true, "custom_fields": [ { "title": "Special Instructions", "uid": "N3W4FIWOAGI7GMYV62MQ7MQ3" }, { "title": "Would you like to be on mailing list", "uid": "J7ETDA6UANCFB3UIXJP5AGL6" } ], "ask_for_shipping_address": true }, "pre_populated_data": { "buyer_email": "buyer@email.com", "buyer_phone_number": "+14155551212", "buyer_address": { "address_line_1": "1455 MARKET ST #600", "locality": "San Jose", "administrative_district_level_1": "CA", "postal_code": "94103", "country": "US" } }, "url": "https://sandbox.square.link/u/J1lWcEhY", "created_at": "2022-04-22T02:50:39Z" }, "related_resources": { "orders": [ { "id": "C0DMgui6YFmgyURVSRtxr4EShheZY", "location_id": "{{LOCATION_ID}}", "source": { "name": "Test Online Checkout Application" }, "line_items": [ { "uid": "8YX13D1U3jO7czP8JVrAR", "name": "Auto Detailing", "quantity": "1", "item_type": "ITEM", "base_price_money": { "amount": 12500, "currency": "USD" }, "variation_total_price_money": { "amount": 12500, "currency": "USD" }, "gross_sales_money": { "amount": 12500, "currency": "USD" }, "total_tax_money": { "amount": 0, "currency": "USD" }, "total_discount_money": { "amount": 0, "currency": "USD" }, "total_money": { "amount": 12500, "currency": "USD" } } ], "fulfillments": [ { "uid": "bBpNrxjdQxGQP16sTmdzi", "type": "DIGITAL", "state": "PROPOSED" } ], "net_amounts": { "total_money": { "amount": 12500, "currency": "USD" }, "tax_money": { "amount": 0, "currency": "USD" }, "discount_money": { "amount": 0, "currency": "USD" }, "tip_money": { "amount": 0, "currency": "USD" }, "service_charge_money": { "amount": 0, "currency": "USD" } }, "created_at": "2022-03-03T00:53:15.829Z", "updated_at": "2022-03-03T00:53:15.829Z", "state": "DRAFT", "version": 1, "total_money": { "amount": 12500, "currency": "USD" }, "total_tax_money": { "amount": 0, "currency": "USD" }, "total_discount_money": { "amount": 0, "currency": "USD" }, "total_tip_money": { "amount": 0, "currency": "USD" }, "total_service_charge_money": { "amount": 0, "currency": "USD" } } ] } }Update the following fields:
description
- Add a description.checkout_options
- Specify a newcustom_fields
("Very Special Instructions"). You verify that both the existing custom fields are deleted.pre_populated_data
- Specify only thebuyer_email
andaddress_line_1
fields. You verify that all other fields are preserved.fields_to_clear
- Specify the field to removecheckout_options.allow_tipping
.
Run the following
UpdatePaymentLink
request to apply the updates:Update payment link
curl https://connect.squareupsandbox.com/v2/online-checkout/payment-links/{id} \ -X PUT \ -H 'Square-Version: 2025-03-19' \ -H 'Authorization: Bearer {ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -d '{ "payment_link": { "version": 1, "description": "updated description", "checkout_options": { "custom_fields": [ { "title": "Very special Instructions " } ] }, "pre_populated_data": { "buyer_email": "buyer-updated@email.com", "buyer_address": { "address_line_1": "1455 MARKET ST #6600" } } }, "fields_to_clear": [ "checkout_options.allow_tipping" ] }'Note that
fields_to_clear
is an array where you provide a comma-separated list of fields to delete. For example:"fields_to_clear": [ "checkout_options.allow_tipping", "pre_populated_data.buyer_address" ]This deletes the
allow_tipping
field fromcheckout_options
and the entirebuyer_address
frompre_populated_data
. To delete the entirecheckout_options
, specify the following:"fields_to_clear": [ "checkout_options ]
You can retrieve a specific payment link by ID or all the payment links in the account. The Checkout API provides the
You can use the
Delete payment link
curl https://connect.squareupsandbox.com/v2/online-checkout/payment-links/{id} \ -X DELETE \ -H 'Square-Version: 2025-03-19' \ -H 'Authorization: Bearer {ACCESS_TOKEN}' \ -H 'Content-Type: application/json'
After receiving the request, the endpoint sets the corresponding order state to CANCELED
and deletes the checkout link.
{ "id": "KFLXPQROJALW56ZX", "cancelled_order_id": "6nJTzvMv7nA28JSKAgDpxlg3vgFZY" }