So a follow-up as to how things were resolved.

Thankfully, the structure of the underlying billing objects was such that the CC was only ever going to be billed once. Additional checking in the run-mode was added to check for a double-submit, but it may not have caught this error (because two requests were coming in simultaneously, the DB might not have been updated in time). That said, a second user click is now addressed properly in the CGI, not just in the underlying API.

Additionally, the form submit was changed from a GET method to a POST method. While it won't explicitely protect against the user double-click, it will throw up the "Are you sure you want to re-submit?" message in most modern browsers. At least it will make the user think twice about their actions.

Thinking about things further, it can be viewed as a cautionary tale for developers who have other people handle the HTML in their templates. The original templates I developed contained template logic & minimal HTML only. When I handed them off, I had tested the app fully, it worked as expected. But I made the mistake of not carefully testing it when I got the templates back (only cursory checks). One of the reasons this took so long to debug was that it never occured to me that the fancy HTML added later could be the culprit. From now on, I'll be vetting every template that someone else touches.


In reply to Follow-up by swngnmonk
in thread CGI Debugging: always the last place you look. by swngnmonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.