Hello,
We cannot say exactly, where you set up the order status in your custom code. In the default check-out process, we save the order to the database when you click the ‘Order now’ button. In code:
~\CMSModules\Ecommerce\Controls\ShoppingCart\ShoppingCartPreview.ascx.cs
I would recommend to check the code where you save the order because by default the order is not marked as paid in the built-in check-out process.
Also check the payment methods in CMSDesk -> E-commerce -> Configuration -> Payment methods -> edit -> Order status when payment …
Then you can also check the code of payment methods how it updates the order when payment fails/succeeds.
Regarding the return from payment screen: The built-in check-out process saves the order before the payment step (when you click the order button). It also throws away the current shopping cart (since it is saved to a new order). The Payment step usually updates the order status and IsPaid flag of the new order.
As you can see, if you click Back in the payment step, it cannot load the previous shopping cart if you understand the current system. You can write a completely custom logic in the check-out steps, see:
Customizing the purchase process and the following article.
Best regards,
Helena Grulichova