add payment_intent.payment_failed to subs
This commit is contained in:
		@@ -288,6 +288,14 @@ Route::post('/payments/stripe/events', function () {
 | 
				
			|||||||
                    'stripe_invoice_paid' => true,
 | 
					                    'stripe_invoice_paid' => true,
 | 
				
			||||||
                ]);
 | 
					                ]);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					            case 'payment_intent.payment_failed':
 | 
				
			||||||
 | 
					                $customerId = data_get($data, 'customer');
 | 
				
			||||||
 | 
					                $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
 | 
				
			||||||
 | 
					                $subscription->update([
 | 
				
			||||||
 | 
					                    'stripe_invoice_paid' => false,
 | 
				
			||||||
 | 
					                ]);
 | 
				
			||||||
 | 
					                send_internal_notification('Subscription payment failed: ' . $subscription->team->id);
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            case 'customer.subscription.updated':
 | 
					            case 'customer.subscription.updated':
 | 
				
			||||||
                $customerId = data_get($data, 'customer');
 | 
					                $customerId = data_get($data, 'customer');
 | 
				
			||||||
                $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
 | 
					                $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user