File tree 1 file changed +3
-3
lines changed
ee/pages/api/integrations/stripepayment
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -102,13 +102,13 @@ type WebhookHandler = (event: Stripe.Event) => Promise<void>;
102
102
const webhookHandlers : Record < string , WebhookHandler | undefined > = {
103
103
"payment_intent.succeeded" : handlePaymentSuccess ,
104
104
"customer.subscription.deleted" : async ( event ) => {
105
- const data = event . data as Stripe . Subscription ;
105
+ const object = event . data . object as Stripe . Subscription ;
106
106
107
- const customerId = typeof data . customer === "string" ? data . customer : data . customer . id ;
107
+ const customerId = typeof object . customer === "string" ? object . customer : object . customer . id ;
108
108
109
109
const customer = ( await stripe . customers . retrieve ( customerId ) ) as Stripe . Customer ;
110
110
if ( typeof customer . email !== "string" ) {
111
- throw new Error ( `Couldn't find customer email for ${ data . customer } ` ) ;
111
+ throw new Error ( `Couldn't find customer email for ${ customerId } ` ) ;
112
112
}
113
113
114
114
await prisma . user . update ( {
You can’t perform that action at this time.
0 commit comments