I think PayPal workflow should be similar to that of Google checkout:- Put the order into the order table in a pending/unconfirmed state
- then continue on to paypal or any other off-site gateway
- then depending on the gateway, whatever the final step is to tell the store to update the order can be triggered to change pending/unconfirmed to processing/accepted
1)The checkout_confirm transfers control to the PaymentPayPal.process function
2)The PaymentPayPal.process function retrieves the order details
and stores them in local variables
3)It then sets the order_status to'Paid Unconfirmed'
4)It clears the shopping cart, the order is stored into the database
5)Then it submits the local variables with the order details via POST or GET and transfers to the PayPal payment gateway.
This step must include the notify_url variable to let PayPal know the callback function
6)PayPal calls back the PaymentPayPal.callback
7)This callback function sends a _notify-validate to PayPal and gets a 'VERIFIED' else assume non-verified
If 'VERIFIED' set the order status to 'pending'
Steps 6. to 8. are optional, we don't have to rely on PayPal to call back. The store owner always can log into his PayPal account to see for himself whether payment has been made or not before processing an order via OpenCart's admin panel.
I might add I haven't studied PayPal's API yet, but I believe above mentioned steps should work and make the system more robust.