#joshua-invoice-paymentintent
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- joshuacs94, 4 days ago, 16 messages
The error seems quite clear no?
The payment intent associated to the invoice requires additional actions (like 3DS)
Yes but I thought it will only throw the error right away when specifying off_session: true because the customer isnt online to complete authentication. Actually, that started to happen after providing the off_session parameter, previous calls didnt specify that param at all and that never happened
Yeah unfortunately issuers can request 3DS/SCA anytime they want
So you'd likely need to bring back the customer on session and have them complete the requried action
The problem is Stripe is throwing an error right away. Normally, if a payment requires 3DS, Stripe will return the payment intent with status requires_action and then we send the client secret back to the UI so it can handleNextActions
Why its not that happening here? And, like I said, in the past, before specifying off_session: false, this never happened
I was expecting off_session: false to behave the same as not specifying such parameter
Can you share example request IDs?
Like where it worked previously and the one that's currently erroring out?
wait
This is the best I have, we started to receive the error invoice_payment_intent_requires_action after we deployed the change with stripe.payInvoice(invoiceId, { off_session: false }), before, the call was a simple stripe.payInvoice(invoiceId)
Unfortuantely I cannot do anything with that
can you provide an example Payment Intent ID?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Whats the actual difference between setting off_session true or false?
Just the ID will be fine. I can't use dashboard links
off_session: "false", means the customer is on-session and can authenticate the transaction
so why would Stripe throw an error instead of returning the Payment Intent with requires_action?
Because the /pay endpoint is not for confirmation.
You need to retrieve the Payment Intent from that invoice and then use it with the Payment Element to confirm the payment
but then I dont see any difference between setting off_session true or false, lol
If you set it to true you are telling the API that the customer is not available to authenticate the payment
In that case we will request and exemption. The bank may or may not grant it. If they do the payment succeeds, if they don't it fails
in fact, before using that parameter, since we werent setting it at all, it was using the default value, which is true and we have been in production for more than 1 year and this started to happen 20 days ago...
And was that when you changed the parameter value to false?
Ok, we deployed the change on Oct 31st, but its not that we changed the value to false... let me give you some context, we are a marketplace and have two types of clients: A and B, where customers of type A are clients of customers of type B. Either an A or a B can request payment of a given invoice. What we changed is that when the request comes from an A, we set off_session: true, because the guy who has to pay the invoice is online, he want to pay the invoice, and if the request comes from a B, of course, we set off_session: false, because the man who has to pay the invoice is not available.
That is eactly the opposite of what that parameter means
So what I was expecting with this off_session: false is that if the payment triggers 3DS Stripe responds with a Payment Intent with status requires_action and then have the customer (the one of type A) complete the authentication flow and payment
Lol? Did I get it wrong?
Not when you are using the /pay API
Sorryyyy, I explained it wrong ๐โโ๏ธ
The response from that API is notifying you that the payment intent does require action but that API is not set up to hanlde that
With clients of type A we set off_session: false and with clients of type B we set it to true
I get that, but then I have 3 questions:
- Why it started to happen now?
- Whats the difference between using true or false since in either case Stripe will throw an error?
- How should I proceed?
- 3DS can be requested by any bank at any time and policies may have changed - we don't have visibility into that
- Both may throw errors that your integration needs to be able to respond to in order to take the right actions
- First set the
off_sessionparameter property:trueif the customer is not available andfalseif the customer is available. Afther that, look into how best to retrive the payment intent where action is needed to examine what thestatusof that payment intent is. If it isrequires_payment_methoduse Stripe.js and the Payment Element to collect a new Payment Method. If it'srequires_actionuse the Stripe.jshandleNextActionmethod for authentication: https://stripe.com/docs/js/payment_intents/handle_next_action
But why would I worry about setting off_session in the first place if both pathways throw an error when the payment triggers 3DS? Whats the benefit of telling Stripe the user is online?
Because we will notify the issuing bank the customer is not online and then it is less likely 3DS will be required
That's the whole point of that flag
Ok, I thought the point was that if you set off_session: false Stripe would respond with a Payment Intent with requires_action so the user can authenticate and throw an error directly if you omit or set off_session: true
We are already handling next actions when payment intents are created directly, I thought the behaviour for invoice payment would be the same
Not when you are attempting to use the Invoice /pay API. It isn't configured for that. You need to retrieven the Payment Intent from the Invoice and use that to handle any next action requirements.
ok, got it, another question
whats the difference between calling invoice.pay(invoiceId) vs paymentIntent.confirm(invoice.payment_intent)?
Both will attempt to confirm the payment for the invoice. However, the payment intent confirm call will return the Payment Intent, which is the object you need to work with if it is in a status of requires_action. You could achieve a similar workflow from the invoice.pay approach by retrieving the Payment Intent when you get the invoice_payment_intent_requires_action error.
So I can forget about invoice.pay and try to confirm the payment intent directly, right? Because in the case invoice.pay throws an error I would have to retrieve the PI anyway