Checkout with Stripe’s Payment Intents

Since Merx 1.2 there is a new payment method called credit-card-sca and a new Cart method called getStripePaymentIntent() which help you to create a SCA-compliant checkout experience.

1. Get Payment Intent

Use $cart->getStripePaymentIntent() to get the client_secret and save the Payment Intent ID in a user session.

$paymentIntent = $cart->getStripePaymentIntent();
$clientSecret = $paymentIntent->client_secret;
$kirby->session()->set('stripePaymentIntentId', $paymentIntent->id);

You need the $clientSecret for the Stripe payment flow in step 2.
stripePaymentIntentId is required for initializePayment() in step 3.

2. Authorize the Payment Intent

Authorize the Payment Intent by following step 2 to 4 of Accept a payment (Custom payment flow) guide.

3. Initialize Payment

Use the Payment Intent ID saved in the user’s session and merge it with other user data.

$data = [
  'paymentMethod' => 'credit-card-sca',
  'email' => '',
  'name' => 'Chuck Norris',
$stripePaymentIntentId = $kirby->session()->get('stripePaymentIntentId');
$data = array_merge($data, [
  'stripePaymentIntentId' => $stripePaymentIntentId,
$redirect = merx()->initializePayment($data);