How do I create customer/order relationship with entities?
You should look at Drupal Commerce, a suite of modules that sets up e-commerce in Drupal.  You will have a much easier time adapting Drupal Commerce to fit your needs than you will writing a store from scratch in Drupal.