Still having no luck tracking this down. There are absolutely no cache commands, and no echo or print commands, just sprint - which, by putting strings directly into variables, shouldn't affect the cache settings.
As with most of the payment plugins I've examined, "onBeforeOrderCreate" is used to handle the communication with the remote server, which authorizes or declines the purchase via curl communications. by the time another method is called by HikaShop, this process is fully resolved: emails have been sent to either confirm or deny the purchase, notices have been sent and put into the application messaging system.
"onAfterOrderConfirm" is used to empty the now-purchased shopping cart, and used "require" to load the template for the "End" or "Thanks" page. It is at this point that the "End" template is printed to the browser. Using ob_get_status, I know that an output buffer already exists, but this require does not render to it. There are no buffer commands in the other payment examples I've seen.
Here's a symptom I don't understand: the program generated progress bar is being inserted in the browser AFTER the "End" template, even though it appears before that content. If I put a "die" statement in the code immediately after the "onAfterOrderConfirm" "require" method, the "End" template is sent to the browser, but the progress bar is not rendered at all, which means it isn't rendered until after the "onAfterOrderConfirm" is completed, and is sent to the browser later. The only way I know for it to precede the already sent text is that it is inserted via javascript - with moo tools already having been called, that is possible.
To sum up: The "End" template is called and rendered, the "onAfterOrderConfirm" function ends, the progress bar is INSERTED before the previously delivered End text, THEN the layout template is rendered and delivered. Since headers have been already sent by the time the layout template HTML is delivered, some basic HTML processes, such as the character set declaration is not executed properly, not to mention that the progress bar and thank you text appears above the entire layout.
There is definitely something inside of Hikashop being triggered early, and I can't find anything that can do that in my code. All the errors take place in "onAfterOrderConfirm", and that method just isn't that complicated.