Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Beta

Payment links

The payment link object and the allowed CRUD operations on the related resource endpoint

A payment link is a shareable URL that allows customers to complete a payment without going through a checkout flow. Whether a payment session is required upfront depends on the provider:

  • Adyen needs a session token before it can display the payment form, so a payment session must already be associated with the link when it's created.

  • Checkout.com also requires a payment session to already be associated with the link when it's created.

  • Stripe requires no session upfront — one is created automatically once the customer completes the checkout, via the checkout.session.completed webhook event. The link is a Stripe payment link that accepts a single completed payment, after which Stripe deactivates it.

A payment link can optionally be associated with an order. When it is, amount_cents and currency_code can be omitted and derived automatically instead of set explicitly (more details below), and product details are shown on the gateway's hosted page. When it isn't, the link is a standalone request for an explicit amount, with no product breakdown — useful for invoice-style payment flows, payment recovery scenarios, or order editing scenarios where the updated total exceeds the previously authorized amount: rather than reattaching the whole order, a payment link for just the outstanding delta can be created with a matching order-less payment session.

A payment link is tied to a single payment setting and a single amount. Once a payment link is completed or expired, a new one must be created for another payment attempt.

Lifecycle

A payment link transitions through the following statuses:

Status
Description

open

The link is active and can be used to initiate a payment.

expired

The link has expired and can no longer be used.

completed

A successful payment has been made via this link.

Adyen and Checkout.com links expire at the gateway. Stripe links never expire on their own: they become expired only when cancelled via the cancel trigger.

URLs

Each payment link has two URL attributes:

  • url — the payment link URL generated by the payment provider, shared with the customer, read-only. For Stripe, it carries the order number, the customer email, and the locale as query parameters, so that the hosted page is prefilled.

  • return_url — the URL the customer is redirected to after completing the payment, optional.

No gateway requires a return URL for the payment link itself. When you omit it, the customer simply stays on the gateway's hosted page once the payment is completed — Stripe shows its own confirmation page, while Adyen shows no Continue button at all.

Session

A payment link is associated with a payment session — either supplied at creation time (Adyen, Checkout.com) or created automatically once payment completes (Stripe). Once associated, the session is accessible via this relationship and contains the transaction history for the payment made through the link.

Where the session is supplied, it's passed through the payment_session relationship in the creation request, and it must already exist: Adyen and Checkout.com build their link request from the session token, so there's nothing to send the gateway without one.

Amount and currency

Both amount_cents and currency_code can be set explicitly at creation time. When omitted, they default to the associated payment session's amount and currency, or — if no session is present yet — to the associated order's outstanding amount and currency. Neither attribute can be changed after creation.

When both a payment session and an order are omitted, amount and currency must be provided explicitly.

Billing address

A payment link's billing address is either inherited from the associated order or provided directly via the billing_address relationship — the latter takes precedence when both are present. When available, it's sent to the gateway along with the payment link creation request.

Display name

The optional name attribute lets you control what's shown on the gateway's hosted page, instead of relying on Commerce Layer's defaults (e.g. Stripe falling back to Order #<number> or Payment when no order is associated). Support depends on the provider:

  • Adyen and Checkout.com — sent as the top-level description field of the payment link request.

  • Stripe — used as the payment link's single line item product name.

Gateway options

At creation time, a payment link accepts an options object whose values are passed straight through to the underlying payment provider, following the same rules as payment sessions.

Triggers

A payment link supports the following trigger attributes:

  • _refresh — syncs the link status with the provider (e.g. marks the link as completed if the payment was made in the meantime). It doesn't change the link amount.

  • _cancel — cancels the link.

  • _internal_version — forces a specific supported internal payload version for this link's creation request.

Last updated