Пример #1
0
        public async Task <string> PaymentCancelReturnUrl(IPNModel ipnModel)
        {
            PDTRequestModel model       = new PDTRequestModel(pdtToken, ipnModel.TransactionId, ipnModel.MerchantOrderId);
            var             pdtResponse = await CheckoutHelper.RequestPDT(model);

            if (pdtResponse.Count() > 0)
            {
                if (pdtResponse["Status"] == "Canceled")
                {
                    //This means the payment is canceled.
                    //You can extract more information of the transaction from the pdtResponse dictionary
                    //You can now mark the order as "Canceled" here.
                }
            }
            else
            {
                //This means the pdt request has failed.
                //possible reasons are
                //1. the TransactionId is not valid
                //2. the PDT_Key is incorrect
            }
            return(string.Empty);
        }
Пример #2
0
        public async Task <ActionResult> PaymentSuccessReturnUrl(IPNModel ipnModel)
        {
            PDTRequestModel model       = new PDTRequestModel(pdtToken, ipnModel.TransactionId, ipnModel.MerchantOrderId);
            var             pdtResponse = await CheckoutHelper.RequestPDT(model);

            if (pdtResponse.Count() > 0)
            {
                if (pdtResponse["Status"] == "Paid")
                {
                    //This means the payment is completed.
                    //You can extract more information of the transaction from the pdtResponse dictionary
                    //You can now mark the order as "Paid" or "Completed" here and start the delivery process
                }
            }
            else
            {
                //This means the pdt request has failed.
                //possible reasons are
                //1. the TransactionId is not valid
                //2. the PDT_Key is incorrect
            }
            return(Redirect("/"));;
        }