#ste_api
1 messages ยท Page 1 of 1 (latest)
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.
- ste_webhooks, 20 hours ago, 14 messages
๐ 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/1225770462932635739
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
The event sended don't have any setup_intent, so, how can I update the default payment of a user?
This problem to set the default payment emerged after the following workflow:
- user do a chekout creating a subscription and a customer via the embedded checkout
- user disable the subscription via api
- user create another subscription via api
In the last step the stripe api will give an error because no default payment on the user is selected.
Maybe my workflow is wrong and I need to change it?
๐ happy to help
'via api' it means the user will use our website and call to disable the subscription, after that the server will call stripe via api
you can actually retrieve the subscription and get the default_payment_method and set the invoice_settings.default_payment_method on the customer
on the event of the checkout completed I have the subscriptionId, in this case I need to retrieve the object of the subscription via api, retrieving the default_payment_method from the object and set the invoice_settings.default_payment_method via api, is that correct?
correct
so, in what case the setup_intent is set on the event checkout completed?
when the Checkout Session is in mode:'setup'
ok, in my case i set the field with subscription, so the value will be always null
I will try the workflow that you suggested and I will let you know if all is working as intended
Ok, it worked, thx for the support
sure let me know if you need any more help
Can I ask here another different question or it's better to create another topic?
I think it's fine to ask here, what's up?
it's a question about the SCA on stripe, from the docs I see that you need to had a flag on the creation of the checkout session or the creation of a new subscription to say that the payment will be on_session or off_session but when I tried it I got an error saying that the field cannot be set for mode subscription so, how stripe manage the SCA on the subscription and what I need to do for my workflow?
well it's mostly all handled for you when using Checkout.
Can you link to the specific doc you're reading? Share the exact error message you got and the code you used to call the API and the request ID req_xxx from the API request that had the error?
let me recreate the error
I set the payment_intent_data on the checkout.sessions.create with the mode subscription and set the setup_future_usage to off_session
and the resulted message error is as following
yeah you don't need to do that at all
ok, so stripe will do all the hard work behind?
setup_future_usage is set automatically on the underlying PaymentIntent when using mode:subscription
ahhhhhh
if it was needed we'd have it in the docs and we don't.
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=stripe-hosted
because I could not find anything on that page about the SCA I tried reading the following docs https://docs.stripe.com/strong-customer-authentication https://stripe.com/it/guides/strong-customer-authentication and the only one that says anything about configs is this one https://docs.stripe.com/payments/setup-intents
I wasn't completely sure about how it was managed on the subscription so I tried testing it
so, in the checkout stripe will do all the hard work but, during the management of subscription, adding price, etc I don't have to do anything for SCA, is this correct?
it's not mentioned because it just works
SCA is a few years old and all products just natively support it
during the management of subscription, adding price, etc
really depends what specifically you mean
it is my first time integrating with payments, all the time I worked on closed projects so I didn't know anything about SCA ๐ฆ
I mean, when I call the api subscriptions.cancel subscriptions.create stripe will manage all the SCA checks or in this case no check will be done until the end of the subscription payment?
sorry I'm confused.
when I call the api subscriptions.cancel
That may or may not generate an Invoice, depends what parameters you pass. In general the payment of an Invoice might require 3D Secure yes. There are multiple ways to pay the Invoice so it's hard to give general advice unfortuantely.
subscriptions.create
you would never call this though? You're using Checkout to create the Subscription.
My workflow is as follow:
- user do a chekout creating a subscription and a customer via the embedded checkout
- user disable the subscription via api
- user create another subscription via api
in the last step I don't create another checkout, I just call subscriptions.create
hmm, why? seems like an odd setup.
In any case, you'd be using the guide https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements to create the Subscription manually then, and it includes steps for using the Subscription's first Invoice's PaymentIntent on the frontend to complete 3D Secure if it's required
example to understand better the management:
- user will create an organization on our platform
- the organization will have different group with different modules
- when all is set a checkout session will be created with the embedded form
- the payment will be processed by stripe and our platform we will manage the customer as the organization
- an user with enough privilege can disable the organization
- disabling the organization will cancel the subscription
- if the user want to re-enable the organization a new subscription must be made, in this case we call the subscriptions.create without letting the user doing nothing except asking to re-enable the organization
if the workflow it's wrong I'm open to change it
but for our needs we think it's correct
so, with the example provided, the creation of the new subscription need another checkout or it's possible to use the workflow explained? at the creation of the new subscription I send the customer, the metadata of the subscription and the items with all the prices/quantity
you don't have to use Checkout, you can call subscriptions.create passing an existing Customer ID and the Prices etc and their existing saved PaymentMethod as default_payment_method. I'd suggest trying it out in test mode.
but do refer to the guide https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements for the overall flow, but note that guide is written assuming the customer is new and you don't have their saved information already, which is different in your case, so you'll have to adapt some parts.
ok, very good