Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

revert

Andras Bacsai38f59b9410ca
diff --git a/routes/webhooks.php b/routes/webhooks.php
index 4c39905e71..dc1caa7c48 100644
--- a/routes/webhooks.php
+++ b/routes/webhooks.php
@@ -281,25 +281,12 @@ Route::post('/payments/stripe/events', function () {
break;
case 'invoice.paid':
$customerId = data_get($data, 'customer');
- $email = data_get($data, 'customer_email');
- $subscription = Subscription::where('stripe_customer_id', $customerId)->first();
- if ($subscription) {
- $planId = data_get($data, 'lines.data.0.plan.id');
- $subscription->update([
- 'stripe_plan_id' => $planId,
- 'stripe_invoice_paid' => true,
- ]);
- break;
- }
- $team = Team::where('email', $email)->first();
- if ($team) {
- $subscription = data_get($team, 'subscription');
- $planId = data_get($data, 'lines.data.0.plan.id');
- $subscription->update([
- 'stripe_plan_id' => $planId,
- 'stripe_invoice_paid' => true,
- ]);
- }
+ $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
+ $planId = data_get($data, 'lines.data.0.plan.id');
+ $subscription->update([
+ 'stripe_plan_id' => $planId,
+ 'stripe_invoice_paid' => true,
+ ]);
break;
case 'payment_intent.payment_failed':
$customerId = data_get($data, 'customer');