public ActionResult PayPayment(int OrderId)
        {
            Models.Order order    = _orderRepo.GetbyId(OrderId);
            payModel     payModel = new payModel()
            {
                Id    = order.Id,
                Total = order.PayAmount
            };

            return(View(payModel));
        }
        public ActionResult PayPayment(payModel payModel)
        {
            Models.Order order     = _orderRepo.GetbyId(payModel.Id);
            var          customers = new CustomerService();
            var          charges   = new ChargeService();

            var customer = customers.Create(new CustomerCreateOptions
            {
                Email       = order.Email,
                SourceToken = payModel.Token,
            });

            var charge = charges.Create(new ChargeCreateOptions
            {
                Amount       = Convert.ToInt32(payModel.Total),//charge in cents
                Description  = "Online Shopping",
                Currency     = "INR",
                CustomerId   = customer.Id,
                ReceiptEmail = order.Email,
                Metadata     = new Dictionary <string, string>()
                {
                    { "OrderId", order.Id.ToString() },
                    { "Name", order.Name },
                    { "Phone", order.Phone },
                    { "Address", order.Address + order.City + '-' + order.PinCode + order.State }
                }
            });

            if (charge.Status == "succeeded")
            {
                order.PaymentStatus         = charge.Status;
                order.Payment_TransactionId = charge.BalanceTransactionId;
                order.ReceiptUrl            = charge.ReceiptUrl;
                _orderRepo.UpdateOrder(order);

                return(RedirectToAction("Paymentreceipt", new { url = order.ReceiptUrl }));
            }
            payModel pasyModel = new payModel()
            {
                Id    = order.Id,
                Total = order.PayAmount
            };

            // further application specific code goes here

            return(View(pasyModel));
        }