protected void Page_Load(object sender, EventArgs e)
    {
        string _reqId = this.Request.Params.Get("payment-id");
        //string controlId = this.FindControl(this.Request.Params.Get("__EVENTTARGET")).ID
        //string _reqId = HttpContext.Request.Query["payment-id"].ToString();
        PaykunPayment        _payment = new PaykunPayment("<merchantId>", "<accessToken>", "<encKey>", _isLive: false); // Change _isLive to false for sandbox mode, While using sandbox mode you will need to provide credintials for sandbox and not of live environment
        TransactionStatusRes transRes = _payment.GetTransactionStatus(_reqId);

        payment_failed_detail.Text = "<table>" +
                                     "<thead>" +
                                     "<tr>" +
                                     "<th>Transaction Id</th>" +
                                     "<th>Amount</th>" +
                                     "<th>OrderId</th>" +
                                     "<th>Customer Name</th>" +
                                     "<th>Customer Email</th>" +
                                     "<th>Mobile</th>" +
                                     "<th>Product Name</th>" +
                                     "</tr>" +
                                     "</thead>" +
                                     "<tbody>" +
                                     "<tr>" +
                                     "<td>" + transRes.data.transaction.payment_id + "</td>" +
                                     "<td>" + transRes.data.transaction.order.gross_amount + "</td>" +
                                     "<td>" + transRes.data.transaction.order.order_id + "</td>" +
                                     "<td>" + transRes.data.transaction.customer.name + "</td>" +
                                     "<td>" + transRes.data.transaction.customer.email_id + "</td>" +
                                     "<td>" + transRes.data.transaction.customer.mobile_no + "</td>" +
                                     "<td>" + transRes.data.transaction.order.product_name + "</td>" +
                                     "</tr>" +
                                     "</tbody>" +
                                     "</table>" +
                                     "<style>table {font-family: arial, sans-serif;border-collapse: collapse;width: 100%;}td, th {border: 1px solid #dddddd;text-align: left;padding: 8px;}tr:nth-child(even) {background-color: #dddddd;}</style>";
    }
Beispiel #2
0
    protected void ProcessPayment_Click(object sender, EventArgs e)
    {
        //Response.Write(name.Text);
        string _orderId = "ORD" + (new Random()).Next(111111111, 999999999).ToString();
        //Your return success page url
        string _successUrl = "http://localhost:61002/Success.aspx";

        string _failureUrl = "http://localhost:61002/Failed.aspx";

        // Change _isLive to false for sandbox mode, While using sandbox mode you will need to provide credintials for sandbox and not of live environment
        PaykunPayment _payment = new PaykunPayment("<merchantId>", "<accessToken>", "<encKey>", _isLive: false);

        //Mandatory //Set 3d currency code as per your requirement like 'INR', 'USD', 'AUD' default is 'INR'
        _payment.InitOrder(_orderId, Double.Parse(amount.Text), product_name.Text, _successUrl, _failureUrl, currency: "INR");

        //Mandatory
        _payment.AddCustomer(name.Text, email.Text, contact.Text);

        //Add here your shipping detail (Optional)
        //If you want to ignore the shipping or billing address, just make all the params an empty string like
        _payment.AddShippingAddress("", "", "", "", "");
        //_payment.AddShippingAddress("address", "country", "state", "city", "pincode");

        //Add here your billing detail (Optional)
        //If you want to ignore the shipping or billing address, just make all the params an empty string like
        _payment.AddBillingAddress("", "", "", "", "");
        //_payment.AddBillingAddress("address", "country", "state", "city", "pincode");

        //You can set your custom fields here. for ex. you can set order id for which this transaction is initiated
        //You will get the same order id when you will call the method  _payment.GetTransactionStatus(_reqId)
        _payment.SetCustomField(_orderId, "", "", "", "");

        Message = _payment.Submit();
        //Response.Write(Message);
        PaymentinnerForm.Text = Message;
    }