Repository navigation
Commerce: Stripe Connect, checkout, webhooks, payouts and billing (Phase 4 K, L, M) - #10
Merged
Merged
Conversation
…youts and billing APIs (Phase 4 K, L, M)
…d sale pricing; document the instance checkout contract
…m-side Stripe failures, highlight the selected organization on Billing
…voke the licence, staff licence management, return URLs on the instance host, members see licences
This was referenced Oct 23, 2026
…fter re-registering or clearing its cache
…st/{version} behind the licence gate, and dist size, sha256 and builtAgainst on catalog and update releases
…ich sticks to later requests
# Conflicts: # app/Models/Instance.php
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.
Stacked on #8, which is stacked on #6. Neither has merged into
release/v2.0.0yet, so this PR targetsfeat/website-inertiaand shows only the commerce commits. When #6 and #8 merge, retarget this PR torelease/v2.0.0. Do not merge it intomain.Phase 4 Workstreams K, L and M: paid extensions are sold through Stripe. Publishers get Stripe Connect Express accounts, prices are mirrored to Stripe, buyers pay on hosted Checkout from a console or the website, and webhooks create purchases and paid licences. Publishers see payouts; organizations see billing.
What's in it
Stripe Connect. Each publisher organization gets one Express account, created with the same controller settings the console uses today: the platform pays Stripe's fees and carries losses. Account Sessions cover embedded onboarding, account management, the notification banner, payouts, tax settings and tax registrations.
payout_status(pending,restricted,enabled,rejected) andmeta.stripecome fromaccount.updated, or from a refresh when onboarding exits.Prices mirrored to Stripe. Saving a price is
PUT …/price, which now also takessale_amountandon_sale. It creates one product per listing, a regular price and the sale price as a second Stripe price (prices.stripe_sale_price_id).on_saledecides which price Checkout charges. A new amount or currency creates a new Stripe price and archives the old one. If Stripe refuses a price, it is not saved (502).Checkout. There are two ways to start one:
POST /v1/instances/me/purchases/checkout(instance token);POST /v1/purchases/checkout(website; owners, admins and billing members of the buyer).Both create a hosted session in
paymentmode with:application_fee_amountfrom the facilitator fee in effect, which has history (facilitator_fees,GET/POST /v1/admin/facilitator-fees);on_behalf_ofthe publisher, who is liable for the tax;The hand-off is a
checkoutsrow. It is polled atGET /v1/instances/me/purchases/{handoff}orGET /v1/purchases/{handoff}.Webhooks.
POST /v1/webhooks/stripechecks the signature against several secrets (the platform endpoint's and the Connect endpoint's). Each event id is stored once inevents.external_id, in the same transaction as its effects. A failure answers 500 and nothing is written.checkout.session.completedandasync_payment_succeededcreate the purchase and a paid licence (5 seats), complete the hand-off and email the receipt. The purchase records amount, fee, net, tax and the receipt URL.checkout.session.expiredexpires the hand-off.charge.refunded(full refund) marks the purchase refunded and revokes the licence. Running instances keep their seat.charge.dispute.createdflags the purchase, revokes its licence and emails staff.account.updatedupdates the publisher's payout status.Payouts and billing APIs. Under
/v1/organizations/{slug}:payouts: balance (available, pending, in transit), payout schedule, recent payouts;payouts/transactionsand.csv: gross, fee, net, status, customer, with totals;billing/purchases: purchases with who bought them and the receipt;billing/licences: licences with the instances holding a seat (any member).Staff licence management.
GET /v1/admin/licences,POST …/{id}/revoke,POST …/{id}/reinstate,PATCH …/{id}(seats).Website pages.
/studio/payouts/{slug?}): Connect.js onboarding and management, balance and sales table, CSV./account/billing/{slug?}): purchases, receipts, licences; shows Finalizing while it polls after a website checkout.registry:stripe-syncreads the state of imported Connect accounts and mirrors imported paid prices. Checkout also does this on demand.README. Covers Stripe setup, settings, routes, webhook effects and the instance checkout contract for registry-bridge (README → Commerce → Instance checkout).
Migrations:
prices.stripe_sale_price_id;facilitator_fees;checkouts;events.external_id.New env (all empty or default in
.env.example):STRIPE_KEY,STRIPE_SECRET,STRIPE_WEBHOOK_SECRET,REGISTRY_FACILITATOR_FEE_BPS,REGISTRY_LICENCE_MAX_ACTIVATIONS,REGISTRY_STRIPE_TAX*,REGISTRY_CHECKOUT_EXPIRES_MINUTES,REGISTRY_CONNECT_COUNTRY,REGISTRY_COMMERCE_NOTIFY.Dependencies:
stripe/stripe-php^22 and@stripe/connect-js3.4.6. Connect.js only loads in the browser, never during SSR.Tests
tests/Feature/Commercerun against real stripe-php with a fake HTTP client that answers from JSON fixtures (tests/Fixtures/stripe) and records every request. They cover Connect, price mirroring, both checkouts and refusals, fee history, every webhook (idempotency, rollback and retry, bad signatures), payouts, CSV, billing, role checks and the two pages. Pint passes.Decisions (answered by Ron)
on_behalf_ofthe publisher, and the publisher's account is liable for the tax. No change needed.exclusive) for now. No change needed.api.acme.comallowsacme.comand*.acme.com).localhostand IP addresses match only themselves.2026-09-30.endive.