#cooldude400_best-practices

1 messages ¡ Page 1 of 1 (latest)

blissful ploverBOT
#

👋 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/1305693132314116117

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

bitter geyser
#

i'm also wondering what the best way to pull "active subscriptions" for a given customer_id is, as https://docs.stripe.com/api/subscriptions/list will pull incomplete and active, and if there are many old incomplete ones, then I can't necesarilly see the active one as the limit is 100 objects?

fossil shard
bitter geyser
#

I saw this, but it requires the person to agree to an $X payment prior to selecting their donations level, which I want to avoid

fossil shard
bitter geyser
#

ah, the docs dont actually list "active" as an option, thank you
The status of the subscriptions to retrieve. Passing in a value of canceled will return all canceled subscriptions, including those belonging to deleted customers. Pass ended to find subscriptions that are canceled and subscriptions that are expired due to incomplete payment. Passing in a value of all will return subscriptions of all statuses. If no value is supplied, all subscriptions that have not been canceled are returned.

fossil shard
#

Sorry, not sure I understand what you mean. Can you provide more details about the exact flow you want to build?

bitter geyser
#

Yes, the flow is:

  • User selects one of 5 options for a monthly donation level
  • A payment sheet button is shown for that dollar amount

My issue is 1) I need to unrender and re-render the payment sheet button each time - is this avoidable?
and 2) I'm currently creating a new paymentintent every time the user changes their selection, which seems wrong. I think I should be creating a monthly incomplete subscription, and then when the user selects a donation level, sending an invoice for that subscription that contians a) the selected amount and b) the preprty that payment of that invoice begisn the subscription for that price

so I think what I want is:

  • Create an incomplete subscription for that user
  • When the user selects a donation level, create an invoice with that price
  • When the user pays the invoice, begin the recurring donatiino at that price
fossil shard
#

For #1, it sounds like that would be avoidable, yeah. Typically in such a flow they would make their selection, then press a button of some kind which would trigger the Payment Sheet for the selected amount.

bitter geyser
#

I see, that makes sense

fossil shard
#

For #2, you don't need to create a Payment Intent every time the Payment Sheet is shown. The docs I linked to above explain how to do that.

#

Also, you should only create a Subscription later in the process.

#

After you get Payment Method details.

#

If you follow the guide I linked above, you basically create the Subscription in step 5. That will create an Invoice, and that Invoice will create a Payment Intent, and that Payment Intent's client secret is what you would return.

bitter geyser
#

got it, i'll try that, Thank you!