Repository navigation
Expand file tree
/
Copy pathSuccess.aspx.cs
More file actions
52 lines (51 loc) · 2.58 KB
/
Copy pathSuccess.aspx.cs
File metadata and controls
52 lines (51 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Paykun;
using Paykun.Json;
public partial class _Success : System.Web.UI.Page
{
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);
if (transRes.status == true && transRes.data.transaction.status == "Success")
{
payment_success_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>";
}
else
{
payment_success_detail.Text = "Payment Faield";
}
}
}