#ste_api

1 messages ยท Page 1 of 1 (latest)

radiant magnetBOT
timber spireBOT
#

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.

radiant magnetBOT
#

๐Ÿ‘‹ 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.

timber spireBOT
placid bear
#

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?

main onyx
#

๐Ÿ‘‹ happy to help

placid bear
#

'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

main onyx
#

you can actually retrieve the subscription and get the default_payment_method and set the invoice_settings.default_payment_method on the customer

placid bear
#

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?

main onyx
#

correct

placid bear
#

so, in what case the setup_intent is set on the event checkout completed?

main onyx
#

when the Checkout Session is in mode:'setup'

placid bear
#

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

timber spireBOT
placid bear
#

Ok, it worked, thx for the support

main onyx
#

sure let me know if you need any more help

placid bear
#

Can I ask here another different question or it's better to create another topic?

latent bridge
#

I think it's fine to ask here, what's up?

placid bear
#

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?

latent bridge
#

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?

placid bear
#

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

latent bridge
#

yeah you don't need to do that at all

placid bear
#

ok, so stripe will do all the hard work behind?

latent bridge
#

setup_future_usage is set automatically on the underlying PaymentIntent when using mode:subscription

placid bear
#

ahhhhhh

latent bridge
placid bear
#

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

Learn how the Strong Customer Authentication regulation affects your business and how to update your integration to support it.

Cosa devono sapere le aziende che operano su Internet riguardo alla regolamentazione europea

Learn more about the Setup Intents API for saving payment methods.

#

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?

latent bridge
#

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

placid bear
#

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?

latent bridge
#

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.

placid bear
#

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

latent bridge
placid bear
#

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

timber spireBOT
placid bear
#

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

latent bridge
#

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.

placid bear
#

ok, very good