APXRAILSdocs

Payment Links

A shareable checkout URL with no code at all — or one API call. Every visit mints a fresh, expiring checkout session, so a link never carries a stale cart.

From the dashboard

Payment Links → New link: name it, price it, create. You get the URL, a QR code, and a website button snippet on one screen. Options: let buyers pick a quantity (1–99) and collect up to three custom fields (order reference, company name, …) before checkout.

From the API

curl
curl https://api.apxrails.com/v1/payment-links \
  -H "Authorization: Bearer apx_sk_test_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: link-sticker-pack" \
  -d '{
    "amount": "4900",
    "currency": "EUR",
    "line_items": [{ "name": "Sticker pack", "quantity": 1, "amount": "4900" }],
    "allow_quantity": true,
    "custom_fields": [
      { "key": "company", "label": "Company", "type": "text", "required": true }
    ],
    "success_url": "https://store.example/thanks"
  }'
response (201)
{
  "id": "plink_01J…",
  "object": "payment_link",
  "active": true,
  "url": "https://pay.apxrails.com/l/plink_01J…",
  "amount": "4900",
  "currency": "EUR"
}

How the page behaves

Plain links redirect straight into a fresh hosted checkout. Links with a quantity toggle or custom fields show a small pre-checkout form first; the values land in the session's metadata.payment_link_fieldsand the quantity multiplies the amount server-side. Deactivated links render a merchant-branded "no longer available" page — POST /v1/payment-links/{id} with { "active": false } flips it (and back).

Embed a link on your site

The same link works as an overlay on your own page — no server-side session needed. Register your site's origin (dashboard → Developers → Embed), then drop in two lines:

html
<script async defer src="https://pay.apxrails.com/embed/v1/loader.js"></script>
<div data-apx-checkout-link-id="plink_01J…"></div>

Each open mints a fresh session inside the sandboxed iframe and binds it to your page's origin before anything renders — an unregistered origin shows nothing. Lifecycle events (apx-checkout:complete and friends) work exactly like the session embed.

Attribution

Sessions minted from a link carry the reference everywhere: checkout.session.completed events include payment_link, and the dashboard list shows sessions created / completed per link so conversion is visible at a glance.