orepor
orepor

Reputation: 945

stripe connect intent with direct charge

I'm trying to migrate from charges to payment intents for a direct-charge flow with connected customers.

I have the clientside code that handles stripe.createPaymentMethod and sends the paymentMethodId to the server.

My serverside code looks like this:

  const intent = await stripe.paymentIntents.create(
                {
                    amount: parseInt(amount),
                    currency,
                    confirmation_method: 'manual',
                    confirm: true,
                    metadata,
                    payment_method: id,
                    customer: customerId,
                    off_session: true,
                },
                {
                    stripe_account: restaurantStripeAccountId,
                },
            );

I'm adding stripe_account as the account of my connected customer - acct_xxxx

Now when testing, cards without 3D secure are working fine - 42424242... but cards with 3D secure such as 4000000000003220 which is coming from here

I get :

Error: Your card was declined. This transaction requires authentication

In my catch clause, before it can even begin my 3D secure roundtrip flow with the client.

Upvotes: 1

Views: 550

Answers (1)

wsw
wsw

Reputation: 861

The problem is the off-session parameter, when you pass this parameter, it means that you want to create a charge where the customer is not present to authorize the 3DS, thus Stripe will try to complete the transactions.

This will obviously fail since the card requires 3DS.

You will need to pass off-session=false in this case.

And to make the off-session=true working in the future, you would need to Setup this card by passing

off-session=false,
setup_future_usage: 'off_session',

Hope the above helps

Upvotes: 2

Related Questions