#barba_code

1 messages · Page 1 of 1 (latest)

inland rainBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1308042875031912528

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

sullen hemlock
#

👋 happy to help

spark fjord
#

Hey Tarzan, hope all goes well

sullen hemlock
#

yes thank you, how about you?

spark fjord
#

Good as well. I just need help with this. I want to know if there is an easy way to do what I am asking for or if is not a simple way make sure I can create something on my side to go one by one in some way, in this second option I would like to know if there is a limit of request I can do to stripe

sullen hemlock
#

where would you get the dpm from for each subscription?

spark fjord
#

Ok, I see I can go 1 by one by the code you sent me
´´

const stripe = require('stripe')('sk_test_9W1R4v0cz6AtC9PVwHFzywti');

const subscription = await stripe.subscriptions.update(
'sub_1MowQVLkdIwHu7ixeRlqHVzs',
{
metadata: {
order_id: '6735',
},
}
);

sullen hemlock
#

instead of going 1 by 1, you can list the subscription and filter by status (active)
https://docs.stripe.com/api/subscriptions/list#list_subscriptions-status and then auto-paginate through the subscriptions 1 by 1
https://docs.stripe.com/api/pagination/auto and update the dpm
you just need to make sure to respect the rate limits and best practices described here
https://docs.stripe.com/rate-limits

Learn about API rate limits and how to work with them.

spark fjord
#

Ok, thanks!

#

I did not check the doc yet, but to get the active subscription list, do we have a filter to retrieve them sorted by the ones that will renew soon?

sullen hemlock
#

no you will get them by desc order of creation

spark fjord
#

Ok I, thanks

#

Have a good day Tarzan!