#damol0_code
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/1222886765497552897
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
const response = await fetch("/create-setup-intent", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ 'items': items }),
});
const { clientSecret } = await response.json();
gclientSecret = clientSecret
console.log(gclientSecret)
const appearance = {
theme: 'stripe',
};
elements = stripe.elements({ appearance, clientSecret: gclientSecret });
const paymentElementOptions = {
//paymentMethodTypes: ['card', 'us_bank_account'],
layout: "tabs",
};
const paymentElement = elements.create("payment")
paymentElement.mount("#payment-element");
}
async function handleSubmit(e) {
e.preventDefault();
setLoading(true);
elements.submit()
const { error } = await stripe.confirmSetup({
//Elements instance that was used to create the Payment Element
elements,
clientSecret: gclientSecret,
confirmParams: {
return_url: "http://localhost:4242/checkout.html"
}
});
// This point will only be reached if there is an immediate error when
// confirming the payment. Otherwise, your customer will be redirected to
// your return_url. For some payment methods like iDEAL, your customer will
// be redirected to an intermediate site first to authorize the payment, then
// redirected to the return_url.
if (error) {
showMessage(error.message);
} else {
showMessage("SI Succeeded. logging SI");
console.log(setupIntent)
}
setLoading(false);
}
Hello! Which part specifically are you struggling with? The error messsage you shared seem pretty verbose
just added relevent part of my front end javascript, if you need that
Error:
user_message:
'You cannot enable automatic_payment_methods and specify payment_method_types.'
Yeah, because you're passing both in your Setup Intent call:
customer=stripe_customer_id,
payment_method_types=[
"card",
"us_bank_account",
],
usage="off_session",
automatic_payment_methods={"enabled": True, "allow_redirects": "never"},
)```
ok, so my question really is - how to I say 1. I want to support bank accounts and credit cards and 2. I want to allow automatic payment methods, without the setup intent throwing an error? (im building an offline nightly payment job)
You'd omit the payment_method_types parameter from your create call and we'd surface only the enabled PMs on the account that meet the payment criteria
ok - where on the dashboard do i specific the enabled PMs for the account?
This flow, basically: https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=elements
thanks...reading that...
thanks...there is enough there to get me trying a few things ...appreciate your help....please leave channel open for a little while in case I have futher issues, fi that is ok wiht you
We leave things open for ~30 minutes. If you need to follow-up after that, you can start a new thread via #help
ok great that test transaction has succeeded. Can you point me to the best source of documentation on handling the response of the paymentIntent to check for success/failure when its a US ACH direct debit, which by their nature dont fully succeed for 2-4 days. Mostly I want to understand the response state, the best attribute on the paymentIntent response to check for this - and how the stripeWebhook for paymentIntent will eventually look when I get confirmation, days later, that an ACH Direct Debit has eventually succeeeded or failed. Thanks
๐ stepping in
Thanks. you dont need the start of this chat
The best thing to do is to test it out and see what the payment_intent.succeeded Event contains
just the last question is relevent, and the context that I am building an offline payment job
But that is the Event you want to listen for -- it will fire when the PaymentIntent moves from processing to succeeded
Similarly, payment_intent.payment_failed will indicate it failed
ok is there also a paymentIntent.processing event I can listen for? I'll be handling both cred cards (instant) and bank accounts so I will need to respond to both immediate confirmations and days-later confirmations
Yep there is