Reputation: 21
I'm facing difficulty in integration of the Stripe customer billing portal using NodeJS. Please, help.
Error:
Cannot read property sessions of undefined.
Upvotes: 2
Views: 1066
Reputation: 96
This error sounds like one that would be thrown by a line of code that looks like
var session = await stripe.billingPortal.sessions.create({
customer: 'cus_XXYYZZ',
return_url: 'https://example.com/account',
});
either because you've not imported the Stripe NodeJS library correctly, or you are using a version prior to 8.45.0, which is the first version of the Stripe NodeJS library to support the Customer Portal.
You should also make sure to closely read and follow the Customer Portal guide in the Stripe docs as there are some nuances that you should understand.
Upvotes: 3