using System.Security.Cryptography;
public static void Main()
const string PublicKey = "e4TBMUzPKk9gBfSg9b8j";
const string PrivateKey = "fOW61oyDsh0L1kOwyg61";
var customerAccountNumber = "1234";
var msisdn = "971527699367";
var operatorCode = "42403";
var subscriptionPlanId = "749";
var initialPaymentproductId = "Games";
var initialPaymentDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ");
var executeInitialPaymentNow = "false";
var recurringPaymentproductId = "Games";
var productCatalogName = "HipstiaGames-DU-ARE";
var executeRecurringPaymentNow = "false";
var contractStartDate = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ");
var contractEndDate = "2022-07-14 17:47:00Z";
var autoRenewContract = "true";
var redirectUrl = "https://www.google.com";
var message = customerAccountNumber + msisdn + operatorCode + subscriptionPlanId + initialPaymentproductId + initialPaymentDate + executeInitialPaymentNow + recurringPaymentproductId + productCatalogName + executeRecurringPaymentNow + contractStartDate + contractEndDate + autoRenewContract + language;
var theDigest = CalculateDigest(PublicKey, PrivateKey, message);
Console.WriteLine("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"+
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n"+
"<title>Document</title>\n" +
"<form action=\"https://live.tpay.me/op/42403/sub/new\" method=\"post\">\n"+
"<label for=\"customer\">Customer</label>\n"+
"<input type=\"text\" name=\"customerAccountNumber\" value=\""+customerAccountNumber+"\">\n"+
"<input type=\"text\" name=\"msisdn\" value=\""+msisdn+"\">\n"+
"<input type=\"text\" name=\"operatorCode\" value=\""+operatorCode+"\">\n"+
"<input type=\"text\" name=\"subscriptionPlanId\" value=\""+subscriptionPlanId+"\">\n"+
"<input type=\"text\" name=\"initialPaymentproductId\" value=\""+initialPaymentproductId+"\">\n"+
"<input type=\"text\" name=\"initialPaymentDate\" value=\""+initialPaymentDate+"\">\n"+
"<input type=\"text\" name=\"executeInitialPaymentNow\" value=\""+executeInitialPaymentNow+"\">\n"+
"<input type=\"text\" name=\"recurringPaymentproductId\" value=\""+recurringPaymentproductId+"\">\n"+
"<input type=\"text\" name=\"productCatalogName\" value=\""+productCatalogName+"\">\n"+
"<input type=\"text\" name=\"executeRecurringPaymentNow\" value=\""+executeRecurringPaymentNow+"\">\n"+
"<input type=\"text\" name=\"contractStartDate\" value=\""+contractStartDate+"\">\n"+
"<input type=\"text\" name=\"contractEndDate\" value=\""+contractEndDate+"\">\n"+
"<input type=\"text\" name=\"autoRenewContract\" value=\""+autoRenewContract+"\">\n"+
"<input type=\"text\" name=\"language\" value=\""+language+"\">\n"+
"<input type=\"text\" name=\"signature\" value=\""+theDigest+"\">\n"+
"<input type=\"text\" name=\"redirectURL\" value=\""+redirectUrl+"\">\n"+
"<button type=\"submit\">Submit</button>\n"+
public static string CalculateDigest(string publicKey, string privateKey, string message)
var hash = new System.Security.Cryptography.HMACSHA256(System.Text.Encoding.UTF8.GetBytes(privateKey));
var correctHash = string.Join(string.Empty, hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(message)).Select(b => b.ToString("x2")));
digest = publicKey + ":" + correctHash;