Update a payment link
How to update an existing payment link via API
To update an existing payment link, send a PATCH request to the /api/2026-05/payment_links/:id endpoint, where id is the ID of the resource that you want to update.
Here below the list of all the possible arguments that you can pass with the request body.
Request
PATCH https://yourdomain.commercelayer.io/api/2026-05/payment_links/:id
Arguments
type
string
Required
id
string
Required
attributes.return_url
string
Optional
attributes._refresh
boolean
Optional
attributes._cancel
boolean
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
Example
The following request updates the payment link identified by the ID "XAyRWNUzyN":
curl -g -X PATCH \
'https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "payment_links",
"id": "xYZkjABcde",
"attributes": {
"return_url": "http://commercelayer.dev/payment_link/process"
}
}
}'On success, the API responds with a 200 OK status code, returning the updated resource object:
{
"data": {
"id": "XAyRWNUzyN",
"type": "payment_links",
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN"
},
"attributes": {
"status": "succeeded",
"amount_cents": 1000,
"amount_float": 10.0,
"formatted_amount": "€10,00",
"currency_code": "EUR",
"name": "Invoice #1234 balance due",
"token": "xxxx-yyyy-zzzz",
"url": "https://checkout.yourbrand.com/:order_id",
"return_url": "http://commercelayer.dev/payment_link/process",
"options": {
"usage": "on_session"
},
"request_data": {},
"response_data": {},
"completed_at": "2018-01-01T12:00:00.000Z",
"expired_at": "2018-01-01T12:00:00.000Z",
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
}
},
"relationships": {
"order": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/order",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/order"
}
},
"billing_address": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/billing_address",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/billing_address"
}
},
"payment_setting": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/payment_setting",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/payment_setting"
}
},
"payment_session": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/payment_session",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/payment_session"
}
},
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/attachments"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/events"
}
},
"event_stores": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/relationships/event_stores",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_links/XAyRWNUzyN/event_stores"
}
}
},
"meta": {
"created_with_version": "2026-05"
}
},
"meta": {
"trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74",
"api_versions": [
"2026-05"
]
}
}Last updated