What could be causing this error? I am facing an error in Drupal 9 Stripe module. After installing the module and setting the private and public keys, I visited the /admin/commerce/orders/84/payments/add page, and selected my newly created 'test stripe payment' as payment gateway. Then, I selected one of the payment methods that I've added from /user/18/payment-methods (Add new payment method). This redirected me to the Add payment page where there is an Amount field and two radio buttons (Authorize only and Authorize and capture) and an Add payment button. When I click on this button, the site crashes with the following error.

Error : Call to a member function getRemoteId() on null dans Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\Stripe-&gt;createPaymentIntent() (/home/mywebsite/www/web/modules/contrib/commerce_stripe/src/Plugin/Commerce/PaymentGateway/Stripe.php line 430)

The line causing the error belongs to this function. Does it mean $payment_method is null? Do you have any idea on what might be causing this error?
/**
  * {@inheritdoc}
  */
public function createPaymentIntent(OrderInterface $order, $capture = TRUE) {
  /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */
  $payment_method = $order-&gt;get('payment_method')-&gt;entity;

  // Line 430
  $payment_method_remote_id = $payment_method-&gt;getRemoteId();
  $customer_remote_id = $this-&gt;getRemoteCustomerId($order-&gt;getCustomer());

  $amount = $this-&gt;toMinorUnits($order-&gt;getTotalPrice());
  $order_id = $order-&gt;id();
  $capture_method = $capture ? 'automatic' : 'manual';
  $intent_array = [
    'amount' =&gt; $amount,
    'currency' =&gt; strtolower($order-&gt;getTotalPrice()-&gt;getCurrencyCode()),
    'payment_method_types' =&gt; ['card'],
    'metadata' =&gt; [
      'order_id' =&gt; $order_id,
      'store_id' =&gt; $order-&gt;getStoreId(),
    ],
    'payment_method' =&gt; $payment_method_remote_id,
    'capture_method' =&gt; $capture_method,
  ];
  if (!empty($customer_remote_id)) {
    $intent_array['customer'] = $customer_remote_id;
  }
  try {
    $intent = \Stripe\PaymentIntent::create($intent_array);
    $order-&gt;setData('stripe_intent', $intent-&gt;id)-&gt;save();
  }
  catch (\Stripe\Exception\ApiErrorException $e) {
    ErrorHelper::handleException($e);
  }
  return $intent;
}
Commerce Stripe is a bit of a mess at the moment.  There are lots of issues that need to be fixed as you can see in the project issue queue.
You are probably experiencing the bug described on Stripe\PaymentIntent instance has invalid ID, but there is a longer discussion about how to handle this at [meta] SCA, the Stripe Review pane and recurring payments.
Basically, the issue is that Commerce Stripe does not generate a payment ID unless you go through the review pane first.  That means that if you configure a standard Commerce checkout flow and go through that flow (login -&gt; cart -&gt; checkout, etc.), then the module will probably work.  If not, you will spend hours searching the issue queue to try to debug the module.
Source: Have spent several frustrated hours over the past couple years with Commerce Stripe.
If it helps, I'm currently using the following patches just to get the module to work on my site:
    &quot;drupal/commerce_stripe&quot;: {
        &quot;do not load stripe library on every page&quot;: &quot;https://www.drupal.org/files/issues/2020-02-03/3083393-21.patch&quot;,
        &quot;skip review step by autosubmit&quot;: &quot;https://www.drupal.org/files/issues/2020-09-16/commerce_stripe-3171411-2.patch&quot;,
        &quot;fix 1112 errors https://www.drupal.org/project/commerce_stripe/issues/3177168&quot;: &quot;https://www.drupal.org/files/issues/2020-10-16/3177168-2_commerce_stripe-fix_address_errors.patch&quot;,
        &quot;fix TrustedCallbackInterface warning https://www.drupal.org/project/commerce_stripe/issues/3168822&quot;: &quot;https://www.drupal.org/files/issues/2020-10-09/PaymentMethodAddForm%20needs%20to%20implement%20TrustedCallbackInterface%20for%20Drupal%209-3168822-14.patch&quot;
    },