I am getting "Invalid payment method" error from Store, even though the payment method I have set on the for is a valid and activated payment method configured within Store.

In this case, I am using the Stripe payment method, with:

Name: Stripe Short Name: stripe

My tag looks like this:

        form_class="lj-form lj-same-addresses"

What could be causing this error to show up?

Edit: After some investigation, somehow it appears that the payment method is being changed to "manual". Still digging.

Edit 2: Okay, the manual issue and the "Invalid payment method" were caused by using some sample code that had the manual payment method thing hard coded as a hidden input.

Now what's happening instead is that I'm sent back to the checkout page without any error appearing. I have inline errors turned off.

Edit 3: Traced this down to an API error from Stripe. It returned the following error, but with inline errors off, Store did not display it.

  "error": {
    "message": "Your card was declined. Your request was in test mode, but used a non test card. For a list of valid test cards, visit: https://stripe.com/docs/testing",
    "type": "card_error",
    "code": "card_declined",
    "charge": "ch_1ZMhyw6xhWwp3R"

So in this case I used one of their recommended test cards and it worked, but that doesn't solve the problem with Store, which is that it doesn't appear to display error messages returned from (some?) APIs in some cases. I had to hack a call to show_error() into Merchant_stripe_response::__construct to get it to show up:

elseif (isset($this->_response->error))
    $this->_status = self::FAILED;
    $this->_message = $this->_response->error->message;

Here's a link to my full template: http://pastebin.com/5zrnQvJN

  • Can you post your full template? Apr 1 '13 at 19:36
  • Link added to bottom of question, Justin. Thx. Apr 1 '13 at 19:59

Thanks for the detailed info.

Correct - setting payment_method="" in your tag simply adds a hidden field to your form, and if you have another hidden field in your template that would override the POST data.

With regards to the error message, even if you aren't using error_handling="inline" in your checkout tag, you still need to use {error:payment_method} somewhere in your template to display errors from the payment gateway. This is because payment gateway errors work slightly differently (they may not show up until the customer is returned from an off-site gateway, so it would be inappropriate to display the EE error page with a "back" button as this would break the checkout flow). We're looking at ways to make this variable behave the same as regular errors, but for now you should have it in next to your payment fields on the final page of the checkout.

Adding {error:payment_method} to your template should remove the need for the edit you made above - can you try that?


What you can also try is to use the {exp:store:payment} tag instead of the {exp:store:checkout} tag..

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.