You must take this problem as seriously as possible and study all the information about distributed system architecture . The payment gateway is an intermediary between your online store and the payment processor, which receives the payment from your customer.