Can't list stripe subscriptions data


I’m trying to create a rule that will retrieve the list of subscriptions from my Stripe customer and add it to the app_metadata of the user profile.

However, when I am receiving the following error: ERROR: Cannot read property ‘list’ of undefined

Snippet of my code in the rule:
var stripe = require(‘stripe’)(‘sk_test_XXXXXXXX’);
var customer = {
customer: user.app_metadata.stripe_customer_id

stripe.subscriptions.list(customer, function(err, subscriptions) {
if (err) {
console.log(“error from stripe”);

Per the Stripe API documentation, this should work:

I’ve verified that the user.app_metadata.stripe_customer_id is populated correctly, and still get the same error
I also tested this with Postman and I am able to retrieve the subscriptions.

Any ideas?

Hi @manu1

It’s possible that the rule is loading an older version of the stripe package. The latest version supported by Auth0 rules is 4.24.0 so try changing your require to require('stripe@4.24.0')

You can view (and request) supported packages here.

Hope this helps!

1 Like