stripe manual confirmation + connected account failing (confirmation_method + stripe_account)

I’m using Stripe’s PHP SDK in a Laravel project, and I’m having a weird issue with 3d secure payments.

PHP Version : 7.4 Stripe-PHP : 7.75.0

When creating a PaymentIntent on behlaf of a connected stripe account using the stripe_account parameter, and the confirmation_method: 'manual' parameter, there’s alway an error stating:

This PaymentIntent pi_XXXXXX cannot be confirmed using your publishable key because its confirmation_method is set to manual. Please use your secret key instead, or create a PaymentIntent with confirmation_method set to automatic.

This is how I created my intent:

$paymentIntentParameters = array(
    'amount' => $priceAsCents,
    'currency' => 'eur',
    'payment_method' => $paymentMethodId,
    'confirmation_method' => 'manual',
    'confirm' => true,
);

$paymentIntent = StripePaymentIntent::create(
    $paymentIntentParameters,
    ['stripe_account' => $store->stripe_token]
);

I followed everything said here: https://github.com/stripe-samples/accept-a-card-payment/tree/master/without-webhooks

I’m in a case where the webhook doesn’t work for me, and where the confirmation_method: 'automatic' doesn’t do the job too, because the confirmation is done on the frontend, and we only want cofirmations on the backend.

Is there any quick fix for this?

Answer

In order to perform server-side (manual) confirmation, you want to follow this doc. Specifically, instead of using handleCardPayment on the frontend, you use createPaymentMethod on the frontend, use the resulting PaymentMethod with a PaymentIntent on the backend, and then confirm on the backend. The linked doc shows the exact steps.