Payment links

Share a URL that opens a hosted checkout — no integration code required.

View as Markdown

A payment link is a shareable URL backed by a product, price, or package. When a customer opens it, PaymentKit creates a fresh checkout session and sends them to the hosted checkout page. The same link can be reused by any number of customers.

Use payment links for one-off charges, subscription sign-ups, or saving a payment method — without writing any checkout integration.

Create a payment link

  1. Go to Payment Links in the sidebar
  2. Click Create Payment Link
  3. Choose the mode (one-time payment, subscription, or setup)
  4. Add the prices or a package to charge for
  5. Optionally set a coupon, success URL, and expiry
  6. Click Create, then copy the shareable URL

The response includes a url you can share directly and a secure_token used by the public endpoint below.

Modes

ModeUse forNotes
paymentA one-time chargePrices must be one-time. Default mode.
subscriptionRecurring billingRequires at least one recurring price. Supports free_trial_days.
setupCollecting a payment method with no chargeNo line items, coupon, or trial.

Request fields

FieldTypeDescription
namestringInternal label for the link (max 255 chars).
modestringpayment, subscription, or setup. Defaults to payment.
line_itemsarrayList of { price_id, quantity, description }. Mutually exclusive with package_ids. Required for payment/subscription unless a package is used.
package_idsarrayPackage IDs to sell instead of individual prices. Mutually exclusive with line_items.
customer_idstringPre-assign the link to an existing customer.
coupon_idstringApply a coupon at checkout.
free_trial_daysintegerFree trial length, 1–730 days. subscription mode only.
success_urlstringWhere to send the customer after a successful payment.
return_urlstringWhere to send the customer if they cancel.
expires_in_hoursintegerHow long the checkout session created from the link stays valid, 1–720 (max 30 days). Defaults to 24.
allow_cart_editbooleanLet customers change quantities at checkout. Defaults to false.
accepted_payment_methodsarrayRestrict to specific methods, e.g. ["credit_card", "apple_pay"]. Omit for all enabled methods.
metadataobjectFree-form JSON.

All line items (or the chosen package) must share a single currency — mixed-currency links are rejected. Prices and packages must be active.

The payment link object

1{
2 "id": "pl_live_x7k9m2n4p8q1",
3 "secure_token": "dGhpcyBpcyBhIHRlc3QgdG9rZW4",
4 "url": "https://api.paymentkit.com/api/pay/share/dGhpcyBpcyBhIHRlc3QgdG9rZW4",
5 "name": "Pro plan signup",
6 "mode": "subscription",
7 "is_active": true,
8 "line_items": [ /* ... */ ],
9 "total_amount_atom": 4900,
10 "currency": "USD",
11 "expires_in_hours": 72,
12 "success_url": "https://example.com/welcome",
13 "created_at": "2026-06-17T14:00:00Z",
14 "updated_at": "2026-06-17T14:00:00Z"
15}
FieldDescription
idPayment link identifier, prefixed pl_.
secure_tokenOpaque token used by the public share endpoint.
urlThe full shareable URL. This is what you give customers.
is_activefalse once the link is deactivated. Inactive links can’t be opened.
total_amount_atom / currencyComputed cart total in the smallest currency unit, and its currency.

How customers pay

When a customer opens the link, the public share endpoint creates a checkout session and routes them to the hosted checkout:

GET /api/pay/share/{secure_token}

This endpoint is public — no API key required — and is rate-limited to 10 requests per minute per IP.

  • Browsers (HTML requests) are redirected straight to the hosted checkout page.
  • API clients (JSON requests) receive the session details to redirect themselves:
1{
2 "checkout_session_id": "cs_live_x7k9m2n4p8q1",
3 "checkout_url": "https://checkout.paymentkit.com/checkout/tok_abc123"
4}

Each open creates a new checkout session, so a single link serves many customers. After payment the customer is sent to success_url; if they cancel, to return_url.

Manage payment links

MethodPathPurpose
GET/api/{account_id}/payment-linksList payment links (paginated, filterable).
GET/api/{account_id}/payment-links/{id}Retrieve a single link.
PATCH/api/{account_id}/payment-links/{id}Update name, coupon, URLs, accepted methods, or set is_active.
DELETE/api/{account_id}/payment-links/{id}Deactivate the link (soft delete; is_active becomes false).

Deactivating a link is permanent in effect for shared URLs — once is_active is false, opening the link returns a generic error and no checkout session is created. Existing checkout sessions already created from the link are unaffected.