Skip to content

Refactor plugin checkout to use cart-based approach - #261

Merged
simonhamp merged 8 commits into
mainfrom
stripe-plugin-updates
Jan 31, 2026
Merged

simonhamp merged 8 commits into
mainfrom
stripe-plugin-updates

Conversation

@shanerbaner82

Copy link
Copy Markdown
Contributor

Summary

  • Refactored plugin checkout to pass cart_id in Stripe metadata instead of comma-separated plugin_ids/bundle_ids
  • HandleInvoicePaidJob now looks up the cart by ID and creates licenses from cart items
  • Switched from checkout.session.completed to invoice.paid webhook for better reliability with delayed payments
  • Cart is cleared and marked as completed after successful purchase
  • Completed carts are now excluded when getting a user's cart (prevents reusing old carts)

Test plan

  • Add plugin to cart and complete checkout
  • Verify license is created after webhook processes
  • Verify cart is cleared after purchase
  • Verify cart icon shows correct count after purchase
  • Add bundle to cart and verify all plugin licenses are created

- Pass cart_id in Stripe metadata instead of plugin_ids/bundle_ids
- HandleInvoicePaidJob now looks up cart and creates licenses from cart items
- Listen for invoice.paid webhook instead of checkout.session.completed
- Clear cart items when cart is marked as completed
- Exclude completed carts when getting cart for user
- Add stripe_checkout_session_id and completed_at to carts table
- Add stripe_invoice_id to plugin_licenses table
shanerbaner82 and others added 6 commits January 26, 2026 05:55
- Store Stripe checkout session ID on cart before redirect
- Allow GET requests to checkout route for post-login redirects
- Fix guest cart transfer to only merge into active (non-completed) carts
@simonhamp
simonhamp merged commit e9257c4 into main Jan 31, 2026
1 of 2 checks passed
@simonhamp
simonhamp deleted the stripe-plugin-updates branch January 31, 2026 18:39
simonhamp added a commit that referenced this pull request Mar 24, 2026
The PluginPurchaseController and its routes were reintroduced by a stale
merge in PR #261 (cart-based checkout refactor), which was based on a
branch predating the tier-based pricing cleanup. The controller referenced
App\Services\GrandfatheringService which was intentionally deleted, causing
BindingResolutionException errors on any request to purchase routes.

The purchase flow was fully replaced by the cart system — nothing in the
app links to these routes. Remove the dead controller, views, and routes.

Closes #44

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
simonhamp added a commit that referenced this pull request Mar 24, 2026
The PluginPurchaseController and its routes were reintroduced by a stale
merge in PR #261 (cart-based checkout refactor), which was based on a
branch predating the tier-based pricing cleanup. The controller referenced
App\Services\GrandfatheringService which was intentionally deleted, causing
BindingResolutionException errors on any request to purchase routes.

The purchase flow was fully replaced by the cart system — nothing in the
app links to these routes. Remove the dead controller, views, and routes.

Closes #44

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
simonhamp added a commit that referenced this pull request Sep 19, 2026
Nothing has dispatched it since plugin checkout moved to invoices in #261.
Its payout logic had drifted from HandleInvoicePaidJob, which made it easy
to misread how payouts work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
simonhamp added a commit that referenced this pull request Sep 19, 2026
…525)

* Create recipient Connect accounts where full accounts can't be paid

Our Stripe platform is in the US, so it can only transfer to connected
accounts on the full service agreement in the US, Canada, the UK, the EEA
and Switzerland. Developers everywhere else now get a recipient account
that only requests the transfers capability.

Adds payouts:recreate-connect-account to move an existing developer onto
a new recipient account and hold their failed payouts until they finish
onboarding again.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Remove unused ProcessPluginCheckoutJob

Nothing has dispatched it since plugin checkout moved to invoices in #261.
Its payout logic had drifted from HandleInvoicePaidJob, which made it easy
to misread how payouts work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Check Stripe for developers we can't pay yet in the daily payout run

We only refreshed a developer's Stripe status when they came back from
onboarding or opened their dashboard. If they finished onboarding and
closed the tab, their held payouts never went out. The daily run now
refreshes anyone we can't pay yet who has held or due payouts before it
decides what to send.

Refreshing no longer overwrites the date onboarding was completed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Email a daily payout summary to support

payouts:send-daily-summary runs at 12:00, an hour after the payout run,
and emails the support address. It covers payouts sent or failed in the
last 24 hours with Stripe's error for each failure, the upcoming and
pending payouts still waiting, and the total paid out to date.

It only skips a day when nothing was sent and nothing is waiting.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
SimonTingle pushed a commit to SimonTingle/nativephp.com that referenced this pull request Sep 19, 2026
* Refactor plugin checkout to use cart-based approach

- Pass cart_id in Stripe metadata instead of plugin_ids/bundle_ids
- HandleInvoicePaidJob now looks up cart and creates licenses from cart items
- Listen for invoice.paid webhook instead of checkout.session.completed
- Clear cart items when cart is marked as completed
- Exclude completed carts when getting cart for user
- Add stripe_checkout_session_id and completed_at to carts table
- Add stripe_invoice_id to plugin_licenses table

* Updates plugin ui a bit

* Udates clear cart logic

* Update PHP version in linting workflow to 8.4

* Update PHP version in GitHub Actions workflow

* Fix cart checkout flow issues

- Store Stripe checkout session ID on cart before redirect
- Allow GET requests to checkout route for post-login redirects
- Fix guest cart transfer to only merge into active (non-completed) carts

* Parameterize PHP version in linting workflow

---------

Co-authored-by: Simon Hamp <simon.hamp@me.com>
SimonTingle pushed a commit to SimonTingle/nativephp.com that referenced this pull request Sep 19, 2026
)

The PluginPurchaseController and its routes were reintroduced by a stale
merge in PR NativePHP#261 (cart-based checkout refactor), which was based on a
branch predating the tier-based pricing cleanup. The controller referenced
App\Services\GrandfatheringService which was intentionally deleted, causing
BindingResolutionException errors on any request to purchase routes.

The purchase flow was fully replaced by the cart system — nothing in the
app links to these routes. Remove the dead controller, views, and routes.

Closes NativePHP#44

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants