Skip to content

Braintree: "Client token has expired" error - Token not regenerated automatically on checkout #40085

@pratikkamani

Description

@pratikkamani

Preconditions and environment

-Magento 2 version: 2.4.7-p3
-PHP version: 8.2
-paypal/module-braintree-core version : 4.6.1-p3

-Braintree Payment Method configured with Merchant ID, Public Key, Private Key, and validated Credentials successfully.

Steps to reproduce

  1. Configure Braintree payment in Magento Admin using valid credentials.
  2. Leave the site idle for more than 24 hours (token expiry period).
  3. Visit the checkout page.
  4. Attempt to proceed with Braintree payment.

Expected result

  • Braintree should regenerate the client token automatically if the previous one is expired.
  • Checkout should load the payment method without errors.

Actual result

Checkout displays an error:
Either the client token has expired and a new one should be generated or the tokenization key has been deactivated or deleted.
Simply opening Stores > Configuration > Sales > Payment Methods in the admin temporarily resolves the issue.

Additional information

  • We have a storefront built on VueJS, checkout and admin interfaces on Magento 2.
  • This issue repeats every Sunday or after site inactivity.
  • Admin config visit appears to refresh the token indirectly.
  • This could be related to the token lifecycle not being managed properly in Magento’s Braintree module.
Braintree.mp4

Release note

Suggestion
Implement a mechanism to regenerate the client token automatically when expired, especially on the checkout load.

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Labels

Issue: needs updateAdditional information is require, waiting for response

Type

No type

Projects

Status

Needs Update

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions