0

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?

  • 1
    Your templates look good, you might try removing 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 like 4242424242424242 will be approved while odd numbers like 4111111111111111 will be declined. – Justin Long Sep 25 '14 at 3:03
  • 1
    You should also try adding {error:payment_method} to your template as it will return errors related to the selected payment method outside of the normal error method approach – Justin Long Sep 25 '14 at 3:05
  • Thanks Justin, both of those proved helpful. Turned out I was testing with an incorrect number! – Tyssen Sep 25 '14 at 6:40
  • I will move my comments to an actual answer – Justin Long Sep 25 '14 at 15:40
1

Your templates looks fine for the most part and you are on the right track to remove error_handling="inline" if you are having issues with the form reloading without submitting as that usually means that there is an error but you don't have the error message logic in your template. Having said that you will want to add

{error:payment_method} 

in your checkout template to have gateway specific errors displayed to you (especially important for off-site gateways).

The dummy gateway works with a limited number of test card numbers so you should use a card number that ends in an even number like 4242424242424242 will be approved while odd numbers like 4111111111111111 will be declined.

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.