commerce-stripe icon indicating copy to clipboard operation
commerce-stripe copied to clipboard

EVENT_BEFORE_CONFIRM_PAYMENT_INTENT no longer functional

Open phillmorgan28 opened this issue 3 months ago • 3 comments

Description

Previously, the server would confirm the PaymentIntent, allowing additional request parameters to be added through the EVENT_BEFORE_CONFIRM_PAYMENT_INTENT event. Our code injected the MOTO flag for mail order payments using this hook. This is no longer functional. Instead, the PaymentIntents are being confirmed client side, preventing the server from injecting any additional parameters.

Steps to reproduce

  1. Install plugin
  2. Create hook as below to inject moto parameter for mail order payments
  3. Hook is never run
        Event::on(PaymentIntents::class, PaymentIntents::EVENT_BEFORE_CONFIRM_PAYMENT_INTENT, static function (PaymentIntentConfirmationEvent $event) {
            if (Craft::$app->user->getIdentity()) {
                $event->parameters['payment_method_options'] = [
                    'card' => [
                        'moto' => true
                    ]
                ];
            }
        });

Additional info

  • Craft CMS version: 4.7.3
  • Stripe for Craft Commerce version: 4.1.1
  • PHP version: 8.2

phillmorgan28 avatar Apr 03 '24 14:04 phillmorgan28

Hi @phillmorgan28

A quick question on this, is it for both people entering their card details correctly and for those choosing to pay with an existing payment method? Or just one or the other?

Thanks!

nfourtythree avatar Apr 16 '24 07:04 nfourtythree

Hi, this is for customers who enter their card details each time. We are not using saved payment methods in our implementation.

Just for clarification, our client uses the front end of their site to enter customer card details from their customers over the phone. We then hook the above event to inject to MOTO flag. Whether the transaction is completed on the front end or admin area doesn't matter, payment intents are never confirmed from the server side anymore, making it impossible to use the moto flag per Stripes docs.

Thanks!

phillmorgan28 avatar Apr 16 '24 08:04 phillmorgan28