API Checkout
Create one-time hosted checkouts with a server-controlled amount for dynamic carts and orders.
API Checkout
API Checkout is for orders whose final price is known only at checkout time: carts, usage-based orders, account marketplaces, license keys, top-ups, and other dynamic purchases.
Your backend creates a short-lived Checkout Session with the final amount and currency. Yolfi
returns a unique ycs_... ID and hosted URL. The buyer opens that URL, chooses a supported network
and token, and Yolfi creates an Invoice for that exact server-approved amount.
Hosted payment URLs share one root format. A ycs_... identifier opens a Checkout Session, while
a Paylink UUID opens the existing fixed-price Paylink:
https://pay.yolfi.com/ycs_0123456789abcdef0123456789abcdef
https://pay.yolfi.com/550e8400-e29b-41d4-a716-446655440001A standalone API Checkout Session does not require or create a Paylink. Paylinks remain the reusable, no-code option for fixed-price products.
Choose the right flow
| Use case | Recommended object | Price comes from |
|---|---|---|
| Fixed product shared repeatedly | Paylink | Saved Paylink price |
| Dynamic cart or one-off order | Checkout Session | Authenticated server request |
| Fixed Paylink with per-attempt metadata or redirect | Paylink-backed Checkout Session | Saved Paylink price |
How it fits together
sequenceDiagram
participant B as Buyer browser
participant M as Merchant backend
participant Y as Yolfi API
participant H as Yolfi hosted checkout
B->>M: Click Pay
M->>M: Recalculate and lock the order total
M->>Y: POST /api/checkout-sessions
Y-->>M: ycs_... + hosted URL
M-->>B: Redirect to hosted URL
B->>H: Choose network and token
H->>Y: Create Invoice from the session snapshot
Y-->>H: Deposit address + crypto amount
B->>Y: Send crypto
Y-->>M: Signed payment.confirmed webhook
M->>M: Fulfill order onceThe browser never supplies the fiat amount. It only chooses how to pay. Product and cart details remain in the merchant's system; Yolfi stores only the final payment amount and correlation IDs. This keeps price authority on your server and avoids maintaining a catalog of temporary Paylinks.