Invalid parameters from Stripe API

Created on 18 September 2023, about 1 year ago
Updated 9 January 2024, 10 months ago

Problem/Motivation

Drupal\commerce_payment\Exception\InvalidRequestException: Invalid parameters were supplied to Stripe's API. in Drupal\commerce_stripe\ErrorHelper::handleException() (line 51 of modules/contrib/commerce_stripe/src/ErrorHelper.php).

Steps to reproduce

The latest DEV is installed. added some Stripe Payment Elements with the TEST API Creds.

Made some test, tried to buy a product over stripe.

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Payment Element

Created by

πŸ‡©πŸ‡ͺGermany bennos

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

Comments & Activities

  • Issue created by @bennos
  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    I'm not sure what the bug is here ... seems you got an error surfaced as expected. Are you sure you're using the right API keys?

  • πŸ‡©πŸ‡ͺGermany bennos

    Some more information.

    Stripe Element is configured as TEST.

    I See the activate Card Payments, Paypal Payments (connected over Stripe) and Gpay.

    I Authorize the Test Gateway and then

    The website encountered an unexpected error. Please try again later.

    Drupal\commerce_payment\Exception\InvalidRequestException: Invalid parameters were supplied to Stripe's API. in Drupal\commerce_stripe\ErrorHelper::handleException() (line 51 of modules/contrib/commerce_stripe/src/ErrorHelper.php).
    Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\StripePaymentElement->doCreatePaymentMethod() (Line: 605)
    Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\StripePaymentElement->createPaymentMethod() (Line: 394)
    Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\StripePaymentElement->onReturn() (Line: 38)
    Drupal\commerce_stripe\Controller\PaymentElementCheckoutController->returnPage()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 49)
    Asm89\Stack\Cors->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    And in the Stripe Developer Logs :
    {
    "error": {
    "message": "PaymentMethods of type paypal cannot be updated at this time.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_2TVBXZaXdRCBVS?t=1695301967",
    "type": "invalid_request_error"
    }
    }

  • πŸ‡©πŸ‡ͺGermany bennos

    The card payments are working, but paypal and giropay does not.
    Look like some logic is needed to handle this or we make clear in installation instructions and readme - only the following payments are supported.

  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    So it sounds like it's working as expected?

  • πŸ‡©πŸ‡ͺGermany bennos

    Yes. Just a bit confusing, when In stripe other payments are enabled like Klarna or Paypal.

    I think we need to make sure that theses Payments Option are not displayed in Payments Elements, id they are activated.
    We also need to mention this in the readme.

    Stripe and Klarna good with the commerce_stripe_klarna module.

  • πŸ‡ΊπŸ‡ΈUnited States rszrama

    Got it. Yes, to date we've only tested credit card and wallet transactions; no other payment methods just yet.

  • πŸ‡¨πŸ‡³China skyredwang Shanghai

    giropay is a single use payment method

    ---- https://stripe.com/docs/payments/giropay/accept-a-payment

    Here is why https://www.drupal.org/project/commerce_stripe/issues/3392413#comment-15... ✨ Add the option to not setup payment methods for future usage Fixed , and the fix is in that issue

    I am not sure about Paypal

Production build 0.71.5 2024