@OctagonNetworks I have find issue with the PHP code is that the 'balance' is being decremented by the 'amount' in the 'if' statement, which means that the 'if' statement will always be true.
To fix this, the 'balance' should be decremented by the 'amount' outside of the 'if' statement.