PayLynks

Payment intents

A payment intent is one attempt to collect an amount. Create it on your server, confirm it from the browser (via checkout) or the server.

Create

POST /api/v1/payment_intents (secret key)

Field Notes
amount Required, cents, before any card surcharge.
description Shown on checkout and receipts.
customer cus_…, required to save the card.
metadata String key/values.

Returns id, client_secret, status: "requires_payment_method".

Quote and confirm

Checkout does this for you. With your own flow:

  • POST /api/v1/payment_intents/:id/quote {client_secret, payment_method} — price for that card (surcharge depends on credit vs debit). Publishable or secret key.
  • POST /api/v1/payment_intents/:id/confirm {client_secret, payment_method} — charge.

Server-only confirm options (secret key):

Field Notes
save_payment_method: true Keep the card on the intent's customer for later. You confirm the customer agreed.
payment_method: "pm_<32 hex>" Charge a PayLynks saved card (see saved cards).
off_session: true Customer not present (recurring, merchant-initiated).
expected_total Refuse to charge if pricing changed from what the payer was told.

Statuses

requires_payment_method → processing → succeeded, or back to requires_payment_method with last_error on a decline. After confirm the intent has amount_total (what was charged) and fee_lines (any surcharge or card price adjustment).

GET /api/v1/payment_intents/:id retrieves one.

View as markdown