#romerocox-Payment
1 messages ยท Page 1 of 1 (latest)
Yes, and with the PaymentIntent, I can generate another secret, right?
My scenario is:
Whenever a user clicks on a "buy now" button, it will generate a subscription, an setupintent and a payment secret.
To avoid multiple sub creation, I'm assigning that subscription_id to that user on my end ( mysql )
Also, I'm recording that setupintent Plus the secret.
What happens is, if the CX goes back to the Plans page, and selects a different plan, the secret and intent retrieved from the DB is related to the other plan, so it messes everything up.
So basically you want to avoid duplicate subscription creations am I right?
that is exactly right
so whenever a sub is left "incomplete" I want the user to get that one and finish it, and during this process, we may need to update the original price_id
OK. Before creating a subscription, you can call https://stripe.com/docs/api/subscriptions/list?lang=curl#list_subscriptions-customer to check what subscriptions has the customer already subscribed.
that I already have on my DB
Why are you updating the price_id after the subscription creation?
OK. Why not cancel the incomplete subscriptions and create new ones for your customers?
I was afraid this would cause trouble depending on how many customers I have and how many times they would change their minds lol
so I thought of doing that to avoid all these unnecessarily requests
What kind of trouble?
Haha, don't worry about that at all.
I was afraid this would somehow ending up blocking my account for some reason
so, there is no easy way to update the price_id on a sub, right?
To my knowledge I don't think Stripe will block an account because too many subscriptions.
Good to know.
For completeness, you can update the price ID of a subscription item: https://stripe.com/docs/api/subscription_items/update?lang=curl#update_subscription_item
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah I saw that, but I'm not sure how to replace the old one
I think that by setting somehow the price_id on the same array offset
that may replace it
You can retrieve the incomplete subscription, and get the subscription item ID from the items list
Yes you can also replace the whole items list
Ok, I'll try that, thank you, sir!
No problem!
bad news:
You cannot update a subscription in incomplete status in a way that results in a new invoice or invoice items. Only minor attributes, like metadata or default_payment_method, can be updated on such subscriptions
need to find another workaround
Cancel the incomplete subscription and create a new one
๐
where can I check if Stripe is being slow or if its my internet? ๐
https://status.stripe.com/ All services are online as of now.
Check Stripe system status and see recent API status updates.