#jscripts_3ds-onsession

1 messages ยท Page 1 of 1 (latest)

dusty latchBOT
#

๐Ÿ‘‹ 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/1271207347280281662

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

rigid hedgeBOT
iron prairie
#

Hi ๐Ÿ‘‹ what does "my purchases are no longer going through" mean? Can you share IDs of example payments or requests that show the behvaior you're referring to? Are you able to reproduce this same behavior in testmode, or is it only for livemode transactions?

unreal saffron
#

const paymentIntent = await stripe.paymentIntents.update(
finalizedInvoice.payment_intent.id,
{
setup_future_usage: "on_session",
description: description,
}
);

#

they are all getting marked incomplete

#

with a 400 error on stripe

#

Error message
"message": "A setup_future_usage value of on_session cannot be used with one or more of the values you specified in payment_method_types. Please remove setup_future_usage or remove these types from payment_method_types: [link]."
"type": "invalid_request_error"

#

payment id of a failed one: pi_3PlapUHCa9cmCqg61eJka1Sj

dusty latchBOT
unreal saffron
#

yes it is working on test mode, just seeing this on production

robust venture
#

jscripts_3ds-onsession

#

@unreal saffron so it's not about "going through" right? It's you trying to explicitly update the PaymentIntent after the fact?

unreal saffron
#

i do it like this:

const finalizedInvoice = await stripe.invoices.finalizeInvoice(invoice.id, {
  expand: ["payment_intent"],
});

const paymentIntent = await stripe.paymentIntents.update(
  finalizedInvoice.payment_intent.id,
  {
    setup_future_usage: "on_session",
    description: description,
  }
);
robust venture
#

okay so you are trying to change the PaymentIntent of an Invoice specifically? And you're saying it works fine in Test mode but not Live mode?

unreal saffron
#

yes and yes

robust venture
#

Do you have an example request where it worked before so I can compare?

unreal saffron
#

are you asking for a paymentId where it worked?

robust venture
#

sure

#

the perfect thing would be the exact req_123 for the really specific API Request that changed this value. Like for the 400, it's much easier if you share that information
But I can figure it out with just the pi_123

unreal saffron
#

i dont see req_id on the body

robust venture
#

thanks, let me have a look

#

do you know when the error started?

unreal saffron
#

august 3rd they all started failing

robust venture
#

Do you know if you just turned on Link maybe? I see the PaymentIntent from Aug 1st had card/cashapp and the new one has card/cashapp/link and Link doesn't support on session

unreal saffron
#

link is on in both our test mode and prod mode, and its working on test mode. were using the payment element and dont show link as an option

robust venture
#

Do you have an example in Test mode where it works so I can compare?

unreal saffron
#

"payment_method_types": [
"card",
"cashapp",
"us_bank_account"
],

robust venture
#

that one doesn't have Link

unreal saffron
#

but in my settings, link is on?

robust venture
#

so I think that's your root cause honestly

#

Invoices + payment_method_types can be really painful to debug unfortunately but I'm fairly confident Link here is the issue

#

Why are you passing setup_future_usage: 'on_session' instead of off_session specifically?
Can you try off_session and see if the update works? That'll confirm if my intuition is correct

unreal saffron
#

one difference we see, is that on prod for link -> custom rules, link is only on for stripe checkout and payment request button

#

but on dev/test mode, its on for all 5: stripe checkout, payment element, express checkout element, card element, payment request button

robust venture
#

ah gotcha wait you're looking entirely in the wrong place

#

that's what I see on my account. I have a feeling you have Link on there and you likely turned it on recently. Can you confirm that?

unreal saffron
#

it is on, but we did not turn it on recently. we think we turned it on a few months ago

robust venture
#

that seems unlikely since the previous PaymentIntent you mentioned didn't have Link

unreal saffron
#

agreed. this is my client, so honestly, i have no idea, just asking him and relaying lol

robust venture
#

Sorry this can be really tough to debug ๐Ÿ˜ฆ
But I think that is why you're suddenly getting errors too.

unreal saffron
#

on my test mode, this setting is grayed out- is this not an option on test mode?

#

was trying to see if it matched there

#

Settings that affect live integration are disabled, but can be edited in live mode.

#

or i guess test mode just mirrors live mode for this settings?

#

and link IS OFF on this account (seperate account, seperate test mode account)

robust venture
#

Looking at the logs I do not see them change the settings in the past week so you might be right.

unreal saffron
#

so i can confirm thats different between the 2 now that im looking at the right settings

robust venture
#

Sorry this is just so problematic to debug but I am fairly confident Link is the cause.

unreal saffron
#

makes sense

robust venture
#

Link does not support "on session reuse" so we error if you try. I think you would get away with just passing setup_future_usage: 'off_session' and that should solve the problem

unreal saffron
#

does off_session work with Link?

robust venture
#

yes

#

I'd still recommend writing to our support team. It's a weird "failure mode" to error like this and it's so hard for you to plan ahead of time.
In theory we should be removing Link from the list of payment_method_types instead but it's because you use Invoice and that forces a certain set of values. I don't want to go too deep into this, it's something we do want to fix. But I had never seen someone hit an error like yours

unreal saffron
#

i can confirm that on prod now that turned off link in invoices like you said, it is working again- first successufl purchase weve had since the 3rd

#

and i will switch to off_session if they want to support link

#

and yeah ill report that to support team too

robust venture
#

Spunds good. I'm glad that unblocked you. It sucks to have you turn off Link since it's such a useful feature (but I'm biased I work for Stripe lol) but that might be the easiest
Note: this will not retroactively apply to previous Invoices already finalized.

What you could do is pass payment_method_types otherwise and remove link from the list. That should work

unreal saffron
#

i pass payment_method_types on the stripe element:
<Elements
stripe={stripePromise}
options={{
mode: "payment",
amount: 4700,
currency: "usd",
payment_method_types: ["card"],
setup_future_usage: "on_session",
}}
>

#

is there another spot to pass that too, or is that what you mean

#

all we display/use is card currently

robust venture
#

Right now you are calling the Update PaymentIntent API server-side to force setup_future_usage because an Invoice will not have it set by default (which is the bane of my existence, it confuses sooooo many people, but I digress)
The problem is that when you pass setup_future_usage, we validate that it's compatible with all values in payment_method_types. And right now it errors because one of those (Link) is incompatible.
What you can do is update both setup_future_usage and payment_method_types

unreal saffron
#

ok perfect, that gives me multiple workarounds/next steps

#

thank you thank you, you've helped me like 5 times this year so far lol

robust venture
#

That's what I'm here for so I'm glad we got you to the right place quickly.