Missing payment method nonce - 3DS

Created on 17 August 2022, about 2 years ago
Updated 2 July 2024, 4 months ago

Problem/Motivation

Unable to submit Braintree payment locally, getting "Missing payment method nonce" in database log and "We encountered an unexpected error processing your payment method. Please try again later." displayed on the frontend of the checkout review page.

Steps to reproduce

  1. Set the Braintree gateway to sandbox/test mode
  2. Enable 3D secure
  3. Purchase a product
  4. Use a test card - 4000000000001091 - 10/23

Debugging steps tried so far

The issue could lie with `commerce_braintree/src/Plugin/Commerce/CheckoutPane/Braintree3DSReview.php`
I can see the nonce being set here and the pane array looks like this. A vardump of that array looks like this.

I cannot see the nonce in the checkout review pane on the frontend.

Array
(
    [#id] => edit-braintree-3ds-review
    [#parents] => Array
        (
            [0] => braintree_3ds_review
        )

    [#theme] => commerce_checkout_pane
    [#type] => container
    [#title] => Drupal\Core\StringTranslation\TranslatableMarkup Object
        (
            [translatedMarkup:protected] => 
            [options:protected] => Array
                (
                )

            [stringTranslation:protected] => 
            [string:protected] => Braintree 3DS review
            [arguments:protected] => Array
                (
                )

        )

    [#attributes] => Array
        (
            [class] => Array
                (
                    [0] => checkout-pane
                    [1] => checkout-pane-braintree-3ds-review
                )

        )

    [#pane_id] => braintree_3ds_review
    [#attached] => Array
        (
            [library] => Array
                (
                    [0] => commerce_braintree/checkout-review
                )

            [drupalSettings] => Array
                (
                    [commerceBraintree] => Array
                        (
                            [clientToken] => token-removed
                            [formId] => commerce-checkout-flow-separate-billing
                            [amount] => 12.95
                            [nonce] => XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX
                            [bin] => 400000
                            [email] => test@test.com
                        )

                )

        )

    [payment_errors] => Array
        (
            [#type] => markup
            [#markup] => <div id="payment-errors"></div>
            [#weight] => -200
        )

    [payment_method_nonce] => Array
        (
            [#type] => hidden
            [#attributes] => Array
                (
                    [class] => Array
                        (
                            [0] => braintree-nonce
                        )

                )

        )

    [#cache] => Array
        (
            [contexts] => Array
                (
                )

            [tags] => Array
                (
                    [0] => commerce_order:1234
                )

            [max-age] => 0
        )

)

Has anyone else faced issued with the nonce missing? As the site is on test gateway in Braintree, 3DS should automatically be enabled in the frontend.

πŸ› Bug report
Status

Closed: works as designed

Version

1.3

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom jozzy_a

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.

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

    Do you happen to know which IDs? I'm pretty sure we're not overriding those but when we enable 3ds we're getting several of these errors.

  • πŸ‡¬πŸ‡§United Kingdom zohera

    I am getting this issue as mentioned above ” Missing payment method nonce β€œ when I use production environment using Braintree payment gateway on my commerce site.
    But sandbox environment is working fine though. Can you please help me to resolve this issue ?

Production build 0.71.5 2024