Starts a subscription by sending the customer through hosted or embedded Checkout. The session carries the price, the trial and the URLs to return to, and the subscription is created once payment is authorised.
A Checkout session. In hosted mode follow url with a 303. In embedded mode url is null and client_secret is set instead: hand it to the Checkout Element and let it mount in place. cancel_url is required either way.
This is how subscriptions are created. There is no endpoint that creates one directly, because a subscription needs a payment mandate and the mandate is what Checkout collects. The subscription does not exist yet when this call returns; it is created when the customer authorises payment, and checkout.session.completed is your signal to provision the account.
i
Send an Idempotency-Key header. This endpoint can move money, and a retried create without a key can
produce a second session and a second charge.
Test it
Run it with a bk_test_ key, open the url it returns, and choose paid at Mollie’s test-mode status selector. BillKit has no test card numbers of its own; Mollie owns that half, and lists them on its Testing page. Then inspect the events it produced in the console under Developers → Events.
// Checkout implements Responsable, so returning it redirects.return $request->user()->checkout('price_9XKp2vQ1', [ 'success_url' => route('welcome'), 'cancel_url' => route('pricing'), 'coupon_code' => 'LAUNCH',]);
Request · React
// Ask your server for an embedded session, then mount the element.// It authenticates with the session's client_secret; there is no// publishable key in BillKit.import { BillKitProvider, CheckoutElement } from "@billkit-eu/react";<BillKitProvider> <CheckoutElement clientSecret={clientSecret} theme={{ colorPrimary: "#2f6bff", borderRadius: "10px" }} onSuccess={({ sessionId }) => router.push(`/welcome?cs=${sessionId}`)} /></BillKitProvider>;