Added a few comments and updated some spelling issues
Updated some comments
Refacotred the code to make it easier to debug and troubleshoot
Updated so that it will only flow into the control statement if there is a balance due, there was a complete IPN which means that the order has completed and paid for in the Bitpay system
A little more refactoring making the code easier to manage.