update invoice paid
This commit is contained in:
		@@ -281,12 +281,25 @@ Route::post('/payments/stripe/events', function () {
 | 
				
			|||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'invoice.paid':
 | 
					            case 'invoice.paid':
 | 
				
			||||||
                $customerId = data_get($data, 'customer');
 | 
					                $customerId = data_get($data, 'customer');
 | 
				
			||||||
                $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
 | 
					                $email = data_get($data, 'customer_email');
 | 
				
			||||||
                $planId = data_get($data, 'lines.data.0.plan.id');
 | 
					                $subscription = Subscription::where('stripe_customer_id', $customerId)->first();
 | 
				
			||||||
                $subscription->update([
 | 
					                if ($subscription) {
 | 
				
			||||||
                    'stripe_plan_id' => $planId,
 | 
					                    $planId = data_get($data, 'lines.data.0.plan.id');
 | 
				
			||||||
                    'stripe_invoice_paid' => true,
 | 
					                    $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,
 | 
				
			||||||
 | 
					                    ]);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'payment_intent.payment_failed':
 | 
					            case 'payment_intent.payment_failed':
 | 
				
			||||||
                $customerId = data_get($data, 'customer');
 | 
					                $customerId = data_get($data, 'customer');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user