In the capturePayment(), voidPayment(), refundPayment() methods we have the following code:

      $remote_id = $payment->getRemoteId();
      $intent = NULL;
      if (strpos($remote_id, "pi_") === 0) {
        $intent = PaymentIntent::retrieve($remote_id);
        $intent_id = $intent->id;
      }
      else {
        $charge = Charge::retrieve($remote_id);
        $intent_id = $charge->payment_intent;
      }

It should be updated to use only the PaymentIntent ID as we always save it for the payment remoteId.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vmarchuk created an issue. See original summary.

jsacksick’s picture

No, you shouldn't do that.

jsacksick’s picture

Take a look at this: https://stripe.com/docs/payments/payment-intents/migration/charges

This is the reason why the current gateway uses the payment intent ID as the remote ID.

vmarchuk’s picture

Title: Update capturePayment(), voidPayment(), refundPayment() methods to charge ID » Update capturePayment(), voidPayment(), refundPayment() methods to use PaymentIntent ID
Issue summary: View changes

As discussed with @jsacksick, the above code has been added to support legacy payments (with stored charge ID) and to support new payments that use PaymentIntent ID as the remote ID.
The old issue is here https://www.drupal.org/project/commerce_stripe/issues/3185801.
So after implementing https://www.drupal.org/project/commerce_stripe/issues/3390551 we only need to use code with PaymentIntent ID.

  • vmarchuk committed 46dd98ff on 8.x-1.x
    Issue #3390553: Update capturePayment(), voidPayment(), refundPayment()...
vmarchuk’s picture

Status: Active » Fixed

Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.