· 5 years ago · Jan 30, 2020, 12:00 PM
1 public static string PayssionBuyProductPayment(string email, string amount, string pmId, string culture, string pid, string affId)
2 {
3 var lang = culture;
4 var trn = ZennoLabTransaction.GetTransactionNumber($"{email}|{affId}",
5 Convert.ToDouble(amount.Replace('.', ',')), pid);
6 var apiKey = ConfigurationManager.AppSettings["PayssionApiKey"];
7 var secretKey = ConfigurationManager.AppSettings["PayssionSecretKey"];
8 var productName = ZennoLabProduct.GetProductComplectName(pid);
9 var productLocale = ZennoLabProduct.GetProductLocale(pid);
10 var sb = new StringBuilder();
11 sb.AppendLine("<html><head><title>Pay</title></head><body onload=\"document.pay.submit();\">");
12 sb.AppendLine("<form id=pay name=pay method=\"POST\" action=\"https://www.payssion.com/payment/create.html\" > ");
13 sb.AppendLine($"<input type=\"hidden\" name=\"api_key\" value=\"{apiKey}\">");
14 sb.AppendLine($"<input type=\"hidden\" name=\"amount\" value=\"{amount}\">");
15 sb.AppendLine($"<input type=\"hidden\" name=\"currency\" value=\"USD\">");
16 sb.AppendLine($"<input type=\"hidden\" name=\"order_id\" value=\"{trn}\">");
17 sb.AppendLine($"<input type=\"hidden\" name=\"pm_id\" value=\"{pmId}\">");
18 sb.AppendLine($"<input type=\"hidden\" name=\"payer_name\" value=\"{lang}\">");
19 sb.AppendLine($"<input type=\"hidden\" name=\"description\" value=\"Order #{trn} {productName} {productLocale}\">");
20 var apiSig = $"{apiKey}|{pmId}|{amount}|USD|{trn}|{secretKey}".GetMD5Hash();
21 sb.AppendLine($"<input type=\"hidden\" name=\"api_sig\" value=\"{apiSig}\">");
22 sb.AppendLine(
23 "You will be redirected to the merchant in 3 seconds. If not press \"Pay\" button. <input type=\"submit\" value=\"Pay\">");
24 sb.AppendLine("</form></body></html>");
25 return sb.ToString();
26 }