If someone wants to use stripe only for registered users, it would be nice to have option to load Stripe javascript based on login status. I solved it for my own purpose by changing this function inside commerce_stripe.module file:

/**
 * Implements hook_init().
 */
function commerce_stripe_init() {
  if(user_is_logged_in()){
    drupal_add_js('https://js.stripe.com/v3', 'external');
  }
}

This way JS is loaded only for logged in users on every page as advised. Also there are no Stripe cookies created for anonymous users.

Comments

miksha created an issue. See original summary.

zenimagine’s picture

zenimagine’s picture

It is amazing the number of cookies on my site since the update. I hope it's possible to disable them because Stripe really does matter. I have a site respectful of my users and compliant with the General Regulation on data protection (European regulation). Since the update, I have Google Analytics cookies from Stripe and other unknown cookies (23 cookies). I am very disappointed with this provider.

tomtech’s picture

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.