0

I'm trying to implement commerce on my D7 site and after installing packs of modules I've installed commerce_stripe module to use Stripe payments.

After I created all necessary things(stripe account, products, stripe api keys, latest stripe-php library in sites/all/libraries/) I'm trying to proceed payment and see an error:

Error making the payment. Please contact shop admin to proceed.

Went to reports -> recent log messages and see:

Failure to load Stripe API PHP Client Library.

Hours of googling and I found few ways how to handle it. Updated Libraries module to the latest version, instead of 7.x-3.0-alpha installed 7.x-3.x-dev, clear cache, run cron. Unfortunately, nothing happens.

trying to locate an error I've found function that trying to load stripe php library. It's commerce_stripe_load_library() in commerce_stripe.module file. Error throws in the beginning of this function:

$library = libraries_load('stripe-php');
  if (!$library || empty($library['loaded'])) {
    watchdog('commerce_stripe', 'Failure to load Stripe API PHP Client Library.', array(), WATCHDOG_CRITICAL);
    return FALSE;
  }

Trying to dpm result of libraries_load() function. and first condition !$library is passed successfully. But $library['loaded'] is FALSE.

Any ideas why? Any help appreciated.

1

Finally found the solution.

There is wrong information about installing library on drupal dot org.

It says

Installation

Install and activate Commerce Stripe and Libraries modules.

Download the latest Stripe PHP release from GitHub.

Extract the contents of the archive into the directory /sites/all/libraries/stripe-php

Create an account at Stripe.com, and insert your API keys from the Stripe

Dashboard into the Commerce Stripe payment method settings at admin/commerce/config/payment-methods.

So the thing is that this is the wrong information. If you go to commerce_stripe.module and find hook commerce_stripe_libraries_info() in 'version arguments' you will see that it tries to locate in file VERSION this pattern:

'pattern' => '/(3.\d+(\.\d+)?)/',

It means that you need version 3 of stripe-php library(depends on your commerce_stripe module version). So fix for this is to use correct version of stripe-php library

UPDATE

You can check necessary library's status by executing drush library-list

you will see something like this:

Name                   Status        Version  Variants          Dependencies  Provider        
stripe-php             Not detected           -                 -             Commerce Stripe 

if stripe-php library's status is not detected, then you user wrong version or place the library to the wrong place.

  • If the documentation on drupal.org is wrong, please open a "bug report" in the module (Commerce Stripe's) issue queue and file the bug against the "documentation". Installation instructions that are wrong are a bug and need to be fixed by the maintainers. – Patrick Kenny Oct 5 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.