Files
summercms/.planning/phases/18.1-payment-gateway-subscriptions/COVERAGE.md

5.7 KiB

API Coverage — Stripe (subscriptions)

Full coverage by default. Opt-outs are explicit, reasoned decisions.

Scope: the Stripe Billing surface the frozen PHP SubscriptionGateway contract touches (pgsub a522376 = ac3d73c + 5fb9dac; pgstripe classes/StripeSubscriptionGateway.php at d00f850, every other pgstripe file at 8b47457, per D-01 and D-15) and its direct neighbours. Implemented in sm-pgstripe-plugin/subscriptions (plugin golem15.pgstripesubscriptions, plan 18.1-03) on stripe-go v87 (pinned API version 2026-09-30.endive); the webhook reads both pre-basil and basil payload shapes (D-21). Payment-mode Checkout and PaymentIntents are Phase 18 (COVERAGE.md of phase 18) and not repeated here.

capability decision reason
customers.create with subscriber metadata INTEGRATE e-mail, name, subscriber_type and subscriber_id metadata; an idempotency key per subscriber and parameters in a 10-minute window, so concurrent checkouts create one customer (WR-02, plan 18.1-08)
customers.retrieve OPT-OUT not in the frozen PHP contract: the stored customer id is trusted, as PHP did
customers.update (sync e-mail or name changes) OPT-OUT not in the frozen PHP contract
checkout.sessions.create (mode subscription) INTEGRATE session_id placeholder in success URL; subscription_data.metadata; the plan's own price in that currency (CR-02); no own idempotency key since quick 261016-myi (WR-04)
checkout.sessions.list + expire (open, subscription mode) INTEGRATE the guarded checkout expires the customer's open subscription sessions before a new one, so one payable session exists (quick 261016-myi, WR-04)
checkout.sessions.retrieve (after the success redirect) OPT-OUT not in the frozen PHP contract: activation comes from the signed customer.subscription.created event
billing_portal.sessions.create INTEGRATE
billing_portal.configurations (create or update) OPT-OUT not in the frozen PHP contract: the portal is configured per account in the Stripe dashboard
subscriptions.retrieve (syncSubscription / reconcile) INTEGRATE also the webhook job's fresh-state read: created/updated apply Stripe's current subscription, 404 falls back to the snapshot (CR-01, 18.1-07); used by Service.SyncSubscription (WR-06)
subscriptions.update cancel_at_period_end true (cancel at period end) INTEGRATE
subscriptions.cancel (cancel immediately) INTEGRATE
subscription cancel_at (read from events and retrieval) INTEGRATE a cancel_at date on an active or trialing subscription maps to cancel_at_period_end true; cleared maps back (portal cancels report cancel_at only; D-21 amended 2026-10-16)
subscriptions.update (resume or un-cancel through the API) OPT-OUT not in the frozen PHP contract: reactivation happens in the billing portal and arrives as customer.subscription.updated
subscriptions.update (plan change, proration) OPT-OUT not in the frozen PHP contract: plan changes go through the billing portal
subscriptions.list / subscriptions.search OPT-OUT not in the frozen PHP contract: reconcile walks local rows and retrieves each
products.create (plan_code and tier_level metadata) INTEGRATE idempotency key over plan id, code, name, description and tier in a 10-min window; syncs of one plan also serialise on a plan lock (quick 261016-myi, WR-03)
products.update INTEGRATE
products archive or delete OPT-OUT not in the frozen PHP contract: deactivating a plan is the local is_active flag
prices.list by lookup_keys with active true INTEGRATE replaces PHP's prices.search with the same outcome (plan 18.1-03 decision, RESEARCH A2)
prices.retrieve (before a checkout) INTEGRATE a missing, inactive, foreign-currency or other-amount price is refused before the session (quick 261016-myi, WR-06)
prices.search OPT-OUT replaced by prices.list with lookup_keys, which is not eventually consistent; same result as PHP
prices.create (recurring, lookup_key _, transfer_lookup_key) INTEGRATE
prices.update active false (archive the replaced price) INTEGRATE
invoices.retrieve / invoices.list OPT-OUT not in the frozen PHP contract: invoice facts arrive in invoice.paid and invoice.payment_failed events
webhook signature verification (Stripe-Signature) INTEGRATE raw body, per-mode subscription signing secret
event customer.subscription.created INTEGRATE
event customer.subscription.updated INTEGRATE
event customer.subscription.deleted INTEGRATE
event invoice.paid INTEGRATE basil parent.subscription_details and pre-basil top-level subscription
event invoice.payment_failed INTEGRATE
event customer.subscription.trial_will_end OPT-OUT not handled by the frozen PHP job: answered 200 Webhook received with no job
event customer.subscription.paused / customer.subscription.resumed OPT-OUT not handled by the frozen PHP job: the status change also arrives as customer.subscription.updated
event customer.subscription.pending_update_applied / pending_update_expired OPT-OUT not handled by the frozen PHP job (no pending updates are created)
event invoice.upcoming / invoice.finalized / invoice.payment_action_required OPT-OUT not handled by the frozen PHP job: payment actions run on Stripe's hosted pages
event checkout.session.completed on the subscriptions endpoint OPT-OUT not handled by the frozen PHP job: the row is created from customer.subscription.created; payment-mode sessions belong to the Phase 18 operator endpoint
billing meters, meter events and usage records OPT-OUT explicitly out of scope: lead fees and metering move to the Quotify port (D-02, deferred)