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:
{exp:store:checkout
next="cart/confirmation"
return="cart/confirmation"
form_class="lj-form lj-same-addresses"
require="name|address1|region|country|postcode|payment"
payment_method="stripe"}
...
{/exp:store:checkout
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;
show_error($this->_response->error->message);exit;
$this->_message = $this->_response->error->message;
}
Here's a link to my full template: http://pastebin.com/5zrnQvJN