Repository navigation
feat(core): add a provider-neutral subscription seam - #114
Open
alexasomba wants to merge 12 commits into
Open
alexasomba wants to merge 12 commits into
alexasomba wants to merge 12 commits into
Conversation
This was referenced Nov 25, 2026
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.
Part of the Flutterwave follow-up in #97. First half of subscriptions: the core seam. The Flutterwave Payment Plans package follows in #107.
Why
Flutterwave supports subscriptions through Payment Plans, but core's subscription engine is Stripe Billing-specific:
Subscription.stripeSubscriptionId,subscriptions/lifecycle.tscalls Stripe directly, and the webhook path only understands Stripe subscription events. A provider package cannot plug into that.This adds an additive seam for providers that manage billing themselves. Stripe keeps its current path and behaviour.
What
PaymentProvidergains optionalgetSubscription,cancelSubscriptionandresumeSubscription.ProviderSubscriptionInfois the normalised state (provider subscription id, status, period, amount, interval).charge.succeededandPaymentStatusResultcan carrysubscription. A provider reports the plan/subscription behind the charge.subscriptions/provider.tsstores provider-managed subscriptions and invoices in the existing collections:subscriptions/lifecycle.tsdispatches cancel/resume to the provider for a provider-managed subscription. Pause and in-place plan changes are refused when the provider does not support them.subscription.updatedis a normalised event for a cancellation or status change outside a charge; core updates the local row.Compatibility
stripeSubscriptionIdandstripeInvoiceIdkeep their names for now; they hold the provider's subscription/plan and invoice id. The changeset documents this. A rename can be a separate pre-1.0 cleanup.Tests
subscription.updatedapplies a cancellation; the Stripe portal refuses a provider-managed subscription; a paid invoice does not extend the period twice; a no-draft renewal is resolved throughgetPaymentStatus; an unrelated no-draft charge is acknowledged and ignored; a subscription cart with vendor items is refused.upstream/main, 0 failures.Next
The Flutterwave package creates one payment plan per subscription, passes
payment_planon checkout, reportsplanfrom verify/webhook, and cancels viaPUT /v3/payment-plans/{id}/cancel. That lands in #107.