#mr-stinky-pants_api

1 messages · Page 1 of 1 (latest)

vestal yokeBOT
#

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

📝 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.

kindred thunder
#

Hello, can you tell me more about what you mean about the pending setup intent being gone? Has the subscription moved to a paid phase at that point? Or is it gone in some other way?

midnight anvil
#

no its still there

#

i mean its not available on the customer object when getting it again at a later time

#

it strange as this used to work and not made any changes, just trying to test some other things out that come pater

kindred thunder
#

What does that mean API-wise? Like what exactly are you doing where it does show up and what exactly are you doing when it shows as not available?

midnight anvil
#

well im gussing the pending setup intent has a time limit or session limit?

#

when accessing the subscription in the same session the pending setup intent is there:
SubscriptionService subscriptionService = new SubscriptionService();
SubscriptionListOptions subscriptionListOptions = new SubscriptionListOptions
{
Customer = customer.Id,
};
subscriptionListOptions.AddExpand("data.items");
subscriptionListOptions.AddExpand("data.pending_setup_intent");

kindred thunder
#

Nope, intents stay usable indefinitely until they are either successfully confirmed or cancelled

#

Which is part of why I am unclear on what you are talking about. Is a field showing up as null? Are you getting an error that it no longer exists?

midnight anvil
#

yes when coming back to this code on a different session subscription.PendingSetupIntent is null

#

and the id

#

i can see in logs it was there when subscription created pm_1QK1z0JKY8YXH2zhjbIaRMFg

#

sorry seti_1QK1o2JKY8YXH2zhHWZLebcn

kindred thunder
midnight anvil
#

oh right its used already

kindred thunder
#

Yeah, honestly I am still confused at what you are trying to do overall. Maybe if you walk me through what API calls you are making for these separate sessions I can get a better idea. Stripe doesn't have a concept of sessions, so I don't want to assume what you mean there.
One thing I will say is that you can create your own SetupIntents for these customers. So if the original SetupIntent from the trial was still used, you can just create another one to save a new payment method without taking a payment. https://docs.stripe.com/api/setup_intents/create

midnight anvil
#

sorry i think i get it, its because there was a bug half way through so my process was not complete but the payment intent had been used

#

i should check if its null and create a new one as you say

kindred thunder
#

Can you walk me through your process and where you are getting stuck? Basically if there is a payment right now, you should use the existing payment intent to make payment and save the card, if there isn't one you can use a SetupIntent. You don't necessarily need to check if there was an existing one in that second scenario, you can just create a setup intent when you realize that you need one

midnight anvil
#

im not used to it because i use subscitions and i guess a payment intent is made automatically

#

theres 2 pages https://www.windowsoftware.co.uk/try so a few people get to the second page and see input card and leave it, but might come back later so i reuse that customer and subscription

#

but i mean if you can create a payment intent maybe i dont need a customer first

#

i was making a customer and subsciption to get subscription.PendingSetupIntent.ClientSecret for the <form id="payment-form"

kindred thunder
#

Gotcha, here it sounds like setup intents would make more sense, it sounds like you are just trying to let users set up their PMs to be charged next cycle rather than charging them something right now.

#

So yeah, using that pending setup intent if it exists and if not creating a new one sounds like it makes sense. Or it might be even easier to try to use that pending setup intent on that first session after the subscription was created and then just create setup intents whenever the user accesses that page again

midnight anvil
#

well its 7 day trial

kindred thunder
#

Yep and it is fine to re-use that setup intent as long as it hasn't already been confirmed. So maybe try to use the pending setup intent for those sevent days and create intents after. The one edge case to keep in mind is that someone might add one card and then come back to add another during that trial

midnight anvil
#

so to use create setupIntent to be used on a subscrition what properties would you need to set?

#

because subscription auto makes one normally

kindred thunder
#

The only thing you would need to specify is customer ID, then when the setup intent is successfully confirmed you can set the newly created payment method as the default for the subscription or customer as appropriate

midnight anvil
#

👍