I'm using Expresso Store to take invoice payments with two forms, one to add the amount of the invoice to the cart (with invoice amount being set by the quantity field which is then multiplied by the product's price of $1) and then a second checkout
form which captures payment details.
The first form works fine, but the second one on submit, keeps getting returned to itself and never redirects to the page set in the return parameter. It's like there's some error that prevents the form from submitting correctly but no errors are reported (error_handling="inline"
is disabled).
In the CP, an order is actually created and shows the correct amount and custom field information, but with an order status of Incomplete and when viewing the details of the order, for every attempt at submitting the second form, there's a row under Transactions with a status of Failed (payment method is correctly reported as Dummy which is what I'm testing with).
First form
{exp:store:product
entry_id="130" {!-- fixed ID of the invoice 'product' --}
empty_cart="yes"
payment_method="Dummy"
return="{segment_1}/{segment_2}/payment-details/"
}
<fieldset>
<label class="formLabel" for="billing_first_name">First Name:</label>
<input name="billing_first_name" type="text" id="billing_first_name" title="Enter the patient's name here" />
</fieldset>
<fieldset>
<label class="formLabel" for="billing_last_name">Last Name:</label>
<input name="billing_last_name" type="text" id="billing_last_name" title="Enter the patient's name here" />
</fieldset>
<fieldset>
<label class="formLabel" for="patientId">SKG Patient ID:</label>
<input name="order_custom1" type="text" value="SKG" id="patientId" title="Enter the patient's id here" />
</fieldset>
<fieldset>
<label class="formLabel" for="invoiceNo">Invoice Number(s):</label>
<input name="order_custom2" type="text" id="invoiceNo" title="Enter the invoice number(s) here" />
</fieldset>
<fieldset>
<label class="formLabel" for="payAmount">Amount you wish to pay ($):</label>
<input name="item_qty" type="text" id="payAmount" title="Enter the amount you wish to pay here." />
</fieldset>
<fieldset>
<input type="submit" name="submit" value="Pay invoice" tabindex="5" class="btn" />
</fieldset>
{/exp:store:product}
Checkout form
{exp:store:checkout
return="{segment_1}/{segment_2}/ORDER_HASH"
payment_method="Dummy"
disable_javascript="yes"
form_class="payment-form"
}
{items}
<dl class="invoice-details">
<dt>Patient name</dt>
<dd>{billing_first_name} {billing_last_name}</dd>
<dt>Patient ID</dt>
<dd>{order_custom1}</dd>
<dt>Invoice number</dt>
<dd>{order_custom2}</dd>
<dt>Invoice total</dt>
<dd>{order_total}</dd>
</dl>
{/items}
<fieldset class="first">
<label class="formLabel" for="payment_name">Name</label>
<input type="text" id="payment_name" name="payment[name]" placeholder="As it appears on card">
</fieldset>
<fieldset>
<label class="formLabel" for="payment_card_no">Card Number</label>
<input type="text" id="payment_card_no" name="payment[card_no]" placeholder="12 digits no spaces">
</fieldset>
<fieldset>
<label class="formLabel" for="payment_exp_month">Expiry</label>
<select id="payment_exp_month" name="payment[exp_month]" style="width:50px">
<option value=""></option>
{exp_month_options}
</select>
<select id="payment_exp_year" name="payment[exp_year]" style="width:75px">
<option value=""></option>
{exp_year_options}
</select>
</fieldset>
<fieldset>
<label class="formLabel" for="payment_csc">Security code</label>
<input type="text" id="payment_csc" name="payment[csc]" placeholder="3 digits on the back of card">
</fieldset>
<fieldset>
<input type="submit" name="submit" value="Complete payment" class="btn" />
</fieldset>
{/exp:store:checkout}
The site is also using Structure but I've tested accessing the pages directly at their template_group/template URLs and get the same result.
Anyone have an idea about what might be tripping it up?
disable_javascript="yes"
to see if the order submits. Also make sure that you are using a card number that ends in an even number like4242424242424242
will be approved while odd numbers like4111111111111111
will be declined.{error:payment_method}
to your template as it will return errors related to the selected payment method outside of the normal error method approach