#Sq-subs

1 messages · Page 1 of 1 (latest)

whole otter
tropic crescent
#

I am using nodejs as backend to get the details. can i share my code with you and can you help me take a look at the process?

#
app.get("/customers", async (req, res) => {
  const email = req.body.email;
  const customers = await stripe.customers.list({
    limit: 3,
    email: email
  })
  const subscriptions = await stripe.subscriptions.list({
      customer: customers.data[0].id
    })
  res.send(customers, subscriptions);
});
#

my goal is to get the customer id then the customer's subscription

#

is there a better way to do it?

whole otter
#

onesecond, let me put something together for you

tropic crescent
#

thank you

whole otter
tropic crescent
#

ohh thank you so much! i will take a look at these

tropic crescent
#

Sorry just another question on Stripe. Is it possible for a customer to change between their subscribed plan?

whole otter
#

you mean like upgrade or downgrade to a different plan?

tropic crescent
#

yes

#

like i have a basic plan and pro plan, would be possible for the same customer to remove the basic and add the pro plan using the same customer id

whole otter
tropic crescent
#

oh i did see this! thank you so much!!

#

is it not possible to put it within the customer portal?

whole otter
#

it's possible to upgrade/downgrade on the customer portal as well. https://stripe.com/docs/billing/subscriptions/customer-portal

On that page above you will see a Preview the customer portal button, if you click on that, you'll be able to play around with a demo customer portal and you can also update the plans for the customer

tropic crescent
#

ohh thats awesome

#

thank you so much