#gewibu_docs
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/1425853586943905823
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- gewibu_achdebit-stripejs, 20 hours ago, 15 messages
- gewibu_ach-microdeposits, 6 days ago, 6 messages
Hey there can you share the snippet where you try to call this and the exact error?
Do you have other usage of Stripe.js that is working and just this piece is not doing what you expect, or is this the only usage of Stripe.js?
just this usage is failing, we already had stripe working in this project and were using it to load in stripe Elements. would screenshots work or do you want the copy-pasted code snippets
@near turret in this code I just have a button component running the handleClick function and the token var passed in is a valid clientSecret I'm getting from server-side. I'm hard coding the billing details just so I can see this function work
hmm this is why i'm surprised you say other stuff works
it doesnt looks like you're handling the Promise from loadStripe (with eg await or a .then() to get the result)
loadStripe returns a promise that resolves to a stripe.js instance, not the instance itself
so eg you can do const stripe_instance = await loadStripe(pk)
otherwise you're trying to access collectBankAccountForPayment on the promise itself, which is not defined
stripe_instance = await loadStripe(process.env.stripePublicKeyPMIC)
stripe_instance.collectBankAccountForPayment({
clientSecret: token,
params: {
payment_method_type: 'us_bank_account',
payment_method_data: {
billing_details: {
name: "John Doe",
email: "ale.toc@emails.com",
},
},
},
expand: ['payment_method'],
})
.then(({paymentIntent, error}) => {
if (error) {
console.log("made it to err");
console.error(error.message);
// PaymentMethod collection failed for some reason.
} else {
console.log("made it to not err");
console.log(paymentIntent);
}
});
};```
this is what I'm trying now and the error is:
oh fixed it by using const, nevermind
new error is complaining that the secret string is incorrect, so what I was feeding it was pi_3SGLTHJHVyuda2Tn0TyD1Znd_secret_oVNDl4yvOccZI5Y0fI4nY6O6j, do I need to truncate this string to not include the payment intent id, or do I need to use a totally different string here?
No that's the correct format, the full client_secret from the payment intent
What is the error telling you is wrong with it?
IntegrationError: Invalid value for stripe.collectBankAccountForPayment: clientSecret should be a client_secret string. You specified: {"token":"pi_3SGLTHJHVyuda2Tn0TyD1Znd_secret_oVNDl4yvOccZI5Y0fI4nY6O6j"}.
ok, you passed an object
you need to unwrap that
so maybe try: clientSecret: token.token based on the code and the error
Ok! token.token worked! Thank you so much for your help here, this has been a thorn in my side lately so I appreciate it a lot
NP!