#swe_api
1 messages ยท Page 1 of 1 (latest)
๐ 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/1374851954265559071
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there! Do you mean that you want to create a SEPA payment method that can be used later, while collecting those payment method details on Stripe Elements?
No, I am not using Stripe elements.
I am using Stripe.js and I have my own UI components.
Yes, I want to create a SEPA payment method, that can be used later.
Let me look into that - I'm not certain whether you can create SEPA payment methods using Stripe.js without Elements
Sure, thank you. We have been usng this flow in sources API.
- Create token using bank details
- Use the token in sources API to create source. But, now sources is deprecated
We tried using the tokens in setup intents - https://dashboard.stripe.com/test/logs/req_uWeFw29qIfHECG?t=1747861210
We got the following error message : "Only US-based bank accounts with USD currency can be used as a payment_method."
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
testing this - sorry, typed that out and forgot to send
Thank you so much for your assistance. This is very critical to us at this hour.
Thanks for your patience here. You already have the payment method details on the backend, isn't that right? Because it looks like you were creating Tokens from the server, as in this request:
https://dashboard.stripe.com/test/logs/req_axtoLSV83hMPHq
If that's the case, you can just create and confirm a SetupIntent and pass the SEPA debit payment method details in payment_method_data. See https://docs.stripe.com/api/setup_intents/create#create_setup_intent-payment_method_data-sepa_debit
and when the SetupIntent is confirmed, you'll receive a pm_ object that you can charge later according to your agreement with your customer
Nope, I just created from the server for testing purpose. But, in real word scenario, we will create the token from the front end.
We'll be using the corresponding JS API.
This is our current flow:
- Use tokens API in Stripe JS (client-side) to tokenize the bank account. API used - https://docs.stripe.com/js/tokens/create_token?type=bank_account
- The token is then used in Stripe REST API (server-side) to create SEPA direct debit source. API used - https://docs.stripe.com/api/sources/create
But, now with sources deprecation, we would appreciate some alternative approach here.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
gotcha. So I think what you're going to need to do is just create a PaymentMethod on the client, and then you'll create & confirm a SetupIntent and pass that PaymentMethod to it
testing that
Sure, please send me the code snippet that you try. I'll also try that parallely.
Btw, we do not want to use Stripe elements here
yep
so you would do something like this:
const paymentMethod = await stripe.createPaymentMethod({ type: "sepa_debit", sepa_debit: { iban: "DE89370400440532013000", }, billing_details: { name: "Jenny Rosen", email: "jennyrosen@example.com", }, });
and then from that you would get a pm_123 which you would then pass to your server and create/confirm a SetupIntent
Yeah I see the docs are slightly wrong here where they say "Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod object that you safely pass to your server to use in an API call."
that would be for creating a PaymentMethod with Elements
I will try this out right away, could you not close this thread, till then?
Sure
Will this work in live environment? I see GPT saying that it will not work in live without elements. Can you confirm this?
๐
if you look in the docs you'll see that we provide an option for providing an iban or an iban element
The llms don't know everything yet
Amazing, the snippet worked just fine, and thank you so much for this.