Phase 2 — Stripe sandbox integration (Checkout Sessions + webhook + OSIS persistence) #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2 sub-issue tracked under #1. Continues from #2 Phase 1.5 (mycelium proof-of-control login landed in
1b05225).Scope
POST /payment/intent?amount=...replaces the stubPOST /payment. Creates a sandbox-mode Checkout Session via thestripe(rust-stripe / async-stripe) crate, returns 303 redirect to Stripe-hosted checkout URL. Success URL:/payment/return?session_id={CHECKOUT_SESSION_ID}.POST /webhooks/stripe. VerifiesStripe-SignatureHMAC-SHA256 over{timestamp}.{payload}with constant-time compare + tolerance window (delegate tostripe::Webhook::construct_eventif the crate exposes it; fall back to manual HMAC otherwise). Oncheckout.session.completed: dedupe onpayment_intent.idagainstPaymentEvent.external_ref(indexed). If new, appendPaymentEvent+ incrementBilling.credit_balance.AppState.users: Arc<Mutex<HashMap<String, UserCredit>>>→Arc<OsisOnboarding>(fromcrates/hero_onboarding_schema/src/onboarding/osis_server_generated.rs:218). Confirms Billing-by-mycelium-address lookup path; likely requires syntheticUserrow keyed by address →sid→Billingrow.STRIPE_SANDBOX_PUBLISHABLE_KEY,STRIPE_SANDBOX_SECRET_KEY,STRIPE_WEBHOOK_SIGNING_KEY) loaded fromhero_procsecret store viahero_proc_sdk::HeroProcRPCAPIClient::secret_get. Env-var fallback for dev (per hero_proc_secrets_and_meta skill).--start/--stop— Replaces the s2-002 stub that exits 2 with a redirect tolab service hero_onboarding_server --start. Useshero_proc_sdk::ActionBuilder+ServiceBuilderfor the server + admin daemons.PaymentProvidertrait (Stripe + ClickPesa + stub) so Phase 3 ClickPesa lands as a trait impl, not a server-wide refactor. Trait shape decision becomes D-13 if it stabilises mid-session.Acceptance gate
lab build --release --installclean across all 4 crates (CLI + schema + server + admin).lab infocheckgreen.scripts/smoke_stripe_sandbox.shexercises:Reused / lifted
payment_intent.idvia thePaymentEvent.external_refindex baked into the s2-002 oschema.freezone_work/znzfreezone_code/Stripe surface is Yew (frontend) + Rhai (archived, read-only); the Rust SDK call site doesn't exist in that codebase. Phase 2 writes the canonical Rust Stripe SDK call site fresh against thestripe-rustcrate + Stripe docs, withstripe::Webhookfor signature verification.Out of scope (Phase 3+)