#theo_defer-invoice
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/1293634231553097750
đ 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.
- theofenol_docs, 1 hour ago, 11 messages
- theofenol_connect-elements-errors, 2 days ago, 53 messages
@atomic grotto do you have more details such as an exact request id req_123 where it's failing and the code you are using to create that PAymentIntent?
yeah, jsut a second
this would be the payment id
pi_3Q844zQ5cKJaskCk0T417pRy
req_Z4W7dzVkJgAZuC
Full details: I am using Stripe connect and creating invoices on the connected account as follows:
const invoice = await stripe.invoices.create({
customer: customer.id,
auto_advance: false,
application_fee_amount: req.finerFee,
},
{
stripeAccount: req.connectedAccountId,
});
then, I want my clients to pay the payment intent of the invoice using Stripe Elements
Gotcha, so that's your issue. You are creating Invoices and those do not use your account's payment method settings so it's causing real issues because you are likely rendering with mode: 'payment' when you are initialized PaymentElement which isn't compatible.
Instead I think you have to explicitly pass the paymentMethodTypes array with the types that are enabled on that account. Or alternatively you should create the Invoice first and then load PaymentElement with that Invoice's PaymentIntent
const options = {
mode: 'payment',
currency: 'ron',
amount: amount,
}
stripeElements.value = stripe.value.elements(options)
indeed
theo_defer-invoice
so yeah that's your problem. It's messy for Invoices, we haven't built this fully yet sadly. So right now you'll have to force paymentMethodTypes: ['card', ...] in that code
or change the logic to create the Invoice upfront (much easier)
could you explain both?
where to inject paymentMethodTypes
and btw, I am already creating the invoice first
stripeElements.value = stripe.value.elements(options) basically here instead of options to pass the paymentIntent?
Oh if you are creating the Invoice first you got things totally confused
You should be initializing PaymentElement with the PaymentIntent's client_secret instead of passing mode/currency/amount
so, it would be stripe.elements(client_secret) ?
where client_secret is retrieved from the paymentIntent attached to my invoice?
but, just a remark, i still want apple pay and google pay to be available - this is why i changed my original card implementation,...
It'd be: https://docs.stripe.com/js/elements_object/create
And it wouldn't change anything for ApplePay and GooglePay
thanks! it worked!
yay!