Repository navigation
Conversation
@kaitencloud/server gains CustomerSessions.createCustomerSession and revokeCustomerSession, generated like its other resource classes: a vendor's backend mints a kst_ session for one of its customers and hands it to the page. @kaitencloud/client gains a session module for that page -- checkout preview, checkout and the customer's invoices -- over the bearer scheme it already has; with a publishable key the session methods refuse before sending anything. The contract snapshot is kaiten billing-step-11's (kaitencloud/kaiten#33): most of this diff is the generated billing surface. The public catalogue now maps the generated types instead of hand-written ones; its output is unchanged. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tom Ribuot <tom.ribuot@kaiten.sh>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The SDK side of kaitencloud/kaiten#33: a vendor's backend mints a customer session, and the customer's browser checks out and reads its invoices with it.
Stacked on #4 (
feat/public-catalog).@kaitencloud/serverCustomerSessions.createCustomerSessionandCustomerSessions.revokeCustomerSession, generated from the contract like the other resource classes (billing spec §14.6.2). The vendor backend calls it with itsksh_token, which must holdwrite:customer_sessions:@kaitencloud/clientA
sessionmodule, for a client created withauthScheme: "bearer"and atokenProviderthat returns the session. The provider is called on every request, so the host can swap in a fresh token beforeexpiresAt.session.previewCheckout(order)→{ status: "preview", dueToday, trialEndsAt }. Totals come from the server.session.checkout(order)→ one of:requires_payment_method: send the customer tosetupUrl, then call again withsetupSessionId;subscribed, withpayment.status∈paid | requires_action | failed | processing | not_required.session.invoices({ cursor?, limit? })→ the customer's issued invoices, withhostedInvoiceUrl. Poll it afterrequires_actionorprocessing.currency→currencyCode, and a price reads as aPlanPrice.TypeErrorbefore sending anything.The checkout flow for the React side is §14.6.4: preview (
dryRun) →requires_payment_method→ hosted setup page (popup, redirect fallback) → second call withsetupSessionId→subscribed/requires_action(link tohostedInvoiceUrl) /failed/processing(pollsession.invoices()).Contract snapshot
contracts/openapi.yamlis kaitenbilling-step-11's, so most of this diff is generated: the billing surface of steps 2–11 in both packages. The public catalogue now maps the generated types instead of the hand-written ones from #4; its output is unchanged.Tests
vp run -r build && vp check && vp test: 226 passing. New tests cover:createCustomerSession.