Before your customers are ready to proceed to payment, you need to take their details for payment, delivery, and your own records, and then move their cart that is in the session table to a specific table that will store orders.
Once the order has been saved and the customer details are supplied, a unique order code is generated and stored in orders.order_fulfilment_code
. This can be used by a payment provider (for example, PayPal, GoCardless, Stripe, and so on) to keep track of the payment processing through their system and back into yours.
First, create the following tables in your database:
CREATE TABLE IF NOT EXISTS `customer` ( `cust_id` int(11) NOT NULL AUTO_INCREMENT, `cust_first_name` varchar(125) NOT NULL, `cust_last_name` varchar(125) NOT NULL, `cust_email` varchar(255) NOT NULL, `cust_created_at` int(11) NOT NULL, `cust_address` text NOT NULL COMMENT 'card holder address', PRIMARY KEY (`cust_id`) ) ENGINE=InnoDB DEFAULT...