Error: Customer requested on payment throws InvalidRequestException

Created on 29 March 2020, over 4 years ago
Updated 19 June 2024, 5 months ago

Hi there,
I have installed drupal commerce 8.x-2.17, stripe-php 7.27.3 over drupal 8.8.4 and Im getting this error in test mode:

The `payment_method` parameter supplied pm_XXXXXXX belongs to the Customer cus_YYYYYYY. Please include the Customer in the `customer` parameter on the PaymentIntent.

Drupal\commerce_payment\Exception\InvalidRequestException: Invalid parameters were supplied to Stripe's API. en Drupal\commerce_stripe\ErrorHelper::handleException() (linea 45 de /var/www/drupal/web/modules/contrib/commerce_stripe/src/ErrorHelper.php).

Am I doing something wrong? I just set pk and sk and trying to use different test cards with same result. Tried to switch on/off 'Collect billing information' with no effect.

UPDATE: I was able to make and order as guest, is when I am already logged that I get the crash.

Thanks in advance,
David Calvo

🐛 Bug report
Status

Active

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France kumkum29

    Hello,

    I get the same error using the Stripe Payment Element gateway.

    On different posts, several people have this error. But I don't see a real solution.

    If I make a first payment, the order and payment work correctly. But if I make a second payment with a registered card in the account, I get this error: The `payment_method` parameter supplied pm_XXXXXXX belongs to the Customer cus_YYYYYYY. Please include the Customer in the `customer` parameter on the PaymentIntent...

    In the Stripe account logs i get this error : Error 400 in /v1/payment_intents / parameter_missing - payment_method..

    That is strange, because a 'payment_method' exists in the request :

    {
      "capture_method": "manual",
      "metadata": {
        "order_id": "35",
        "store_id": "2"
      },
      "automatic_payment_methods": {
        "enabled": "true"
      },
      "currency": "eur",
      "setup_future_usage": "on_session",
      "payment_method": "pm_xxxxxxxx",
      "amount": "3000
    

    Stripe display this warning :

    {
      "capture_method": "manual",
      "metadata": {
        "order_id": "35",
        "store_id": "2"
      },
      "automatic_payment_methods": {
        "enabled": "true"
      },
      "currency": "eur",
      "setup_future_usage": "on_session",
      "payment_method": <required>,
      "amount": "3000
    

    Is this a problem with the API version called?

    In this post https://www.drupal.org/project/commerce_stripe/issues/3455608#comment-15... 💬 Use Stripe Card Element OR Stripe Payment Element ? Explanation Closed: duplicate , I talk about this problem with jsacksick. Apparently, the implementation of Stripe Payment Element does not allow the use tokenize payment methods. Also it is not possible to manually add a payment method to the account, and perhaps use a registered card.

    Can you confirm it? Or does the problem come from another element?

    If yes, i must disable to acces payment methods in user account and disable registered card on the payment pane.

    Thanks for yours replies and explanations.

  • 🇫🇷France kumkum29

    Hello,

    After a lot of testing, I just discovered a strange behavior on Stripe payment. The errors mentionned in the previous post appear if I am connected with user account 1 !
    If I use another account, I can complete the payment process without problems, and I can reuse a registered card. (with the Stripe Card Element and Stripe Payment Element method).

    Have you ever seen this behavior?

Production build 0.71.5 2024