Developers
Session continuity
By default every checkout starts fresh. Turn on continuity and a buyer who closes the checkout and opens it again gets the same checkout back: their cart, email, billing address and chosen saved card.
Turn it on
Set continuity for every checkout on the page, or per call:
plandalf('configure', { continuity: 'tab' }); // every checkout on the page
plandalf.present('YOUR-CHECKOUT', { continuity: 'browser' }); // just this one
| Value | Reopens the checkout |
|---|---|
false | Never. Every checkout is new. This is the default. |
'tab' | In the same browser tab, until the tab closes (sessionStorage). |
'browser' | In any tab in the same browser, after it's closed and reopened (localStorage). |
present() and mount() both take it. A completed checkout is cleared, so the next one after a purchase is new.
Saved details
Plandalf saves the buyer's progress on its server as they go: their email, billing address (country first, since it decides tax), chosen saved card, add-ons and other fields. Card numbers and CVCs are never saved; they stay inside Stripe's payment form until the buyer pays.
Session tokens
Each checkout session comes with a signed token that starts with cks_. The SDK keeps it under plandalf_session:<checkout slug> and sends it with the next present() or mount() for that checkout. Plandalf reopens the session only if the token's signature is valid and the session belongs to your organization and that checkout, hasn't been paid, and the checkout hasn't been edited since the session started. Otherwise it starts a new one. Tokens last 24 hours. Each time Plandalf reopens the session it signs a fresh token for the same session, so the 24 hours start again from that visit.
Send a link that reopens a checkout
Create a session on your server with POST /api/v1/checkouts. It returns the session and its token, which can last up to 7 days with exp_seconds:
curl -X POST https://admin.plandalf.dev/api/v1/checkouts \
-H "Authorization: Bearer $PLANDALF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"offer": "YOUR-CHECKOUT", "customer": {"email": "ada@example.com", "name": "Ada Lovelace"}, "exp_seconds": 604800}'
Put the token anywhere in a link to a page with the SDK, as a query value or after #:
https://example.com/pricing?continue=cks_…
https://example.com/pricing?session=cks_…
https://example.com/pricing#cks_…
When the page loads, the SDK picks up the token, and the first checkout opened on that page uses it, whatever the parameter is called. Use it for "finish your purchase" emails, QR codes or a hand-off from your app.
Choose the session yourself
session overrides everything above for one call:
plandalf.present('YOUR-CHECKOUT', { session: 'cks_…' }); // reopen this session
plandalf.present('YOUR-CHECKOUT', { session: null }); // start fresh, ignoring saved and link tokens
With identified buyers
When you identify buyers, Plandalf can also find a signed-in buyer's unfinished checkout from their token, and won't reopen a checkout that belongs to a different buyer. The rules are in Identify buyers.
After a payment redirect
Some payment methods, such as 3D Secure challenges, Klarna and Affirm, send the buyer to another page and back. You don't need code for this: when they return, the SDK reopens the checkout and finishes the payment.