#joshua-invoice-paymentintent

1 messages ยท Page 1 of 1 (latest)

muted gullBOT
#

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.

toxic grove
#

The error seems quite clear no?

#

The payment intent associated to the invoice requires additional actions (like 3DS)

glossy nymph
#

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

toxic grove
#

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

glossy nymph
#

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

toxic grove
#

Can you share example request IDs?

Like where it worked previously and the one that's currently erroring out?

glossy nymph
#

wait

muted gullBOT
glossy nymph
#

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)

worldly anchor
#

Unfortuantely I cannot do anything with that

#

can you provide an example Payment Intent ID?

glossy nymph
#

Whats the actual difference between setting off_session true or false?

worldly anchor
#

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

glossy nymph
#

so why would Stripe throw an error instead of returning the Payment Intent with requires_action?

worldly anchor
#

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

glossy nymph
#

but then I dont see any difference between setting off_session true or false, lol

worldly anchor
#

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

glossy nymph
#

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...

worldly anchor
#

And was that when you changed the parameter value to false?

glossy nymph
#

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.

worldly anchor
#

That is eactly the opposite of what that parameter means

glossy nymph
#

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?

worldly anchor
#

Not when you are using the /pay API

glossy nymph
#

Sorryyyy, I explained it wrong ๐Ÿ’†โ€โ™‚๏ธ

worldly anchor
#

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

glossy nymph
#

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:

#
  1. Why it started to happen now?
#
  1. Whats the difference between using true or false since in either case Stripe will throw an error?
#
  1. How should I proceed?
worldly anchor
#
  1. 3DS can be requested by any bank at any time and policies may have changed - we don't have visibility into that
  2. Both may throw errors that your integration needs to be able to respond to in order to take the right actions
  3. First set the off_session parameter property: true if the customer is not available and false if the customer is available. Afther that, look into how best to retrive the payment intent where action is needed to examine what the status of that payment intent is. If it is requires_payment_method use Stripe.js and the Payment Element to collect a new Payment Method. If it's requires_action use the Stripe.js handleNextAction method for authentication: https://stripe.com/docs/js/payment_intents/handle_next_action
glossy nymph
#

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?

worldly anchor
#

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

glossy nymph
#

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

worldly anchor
#

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.

glossy nymph
#

ok, got it, another question

muted gullBOT
glossy nymph
#

whats the difference between calling invoice.pay(invoiceId) vs paymentIntent.confirm(invoice.payment_intent)?

worldly anchor
#

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.

glossy nymph
#

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

noble glacier
#

joshua-invoice-paymentintent

#

Yes that would work

glossy nymph
#

With paymentIntent.confirm its only one call

#

Ok, guys. Thanks for your time!