string INTEGRATION_ID = “8766Preformatted text5”, INTEGRATION_KEY = “3fd0e24ce-8768-4154-89a5-8625c09785c8”;
var paynow = new Paynow(INTEGRATION_ID, INTEGRATION_KEY);
paynow.ResultUrl = "http://example.com/gateways/paynow/update";
paynow.ReturnUrl = "http://example.com/return?gateway=paynow";
// Create new payment and pass in the reference and payer's email address
var payment = paynow.CreatePayment("Invoice 12","Myemail@gmail.com");
// Passing in the name of the item and the price of the item
payment.Add("Bananas", 2.5m);
// Save the response from paynow in a variable
//var response = paynow.Send(payment);
var resp = paynow.SendMobile(payment, "773949823", "Ecocash");
if (resp.Success())
{
// Get the url to redirect the user to so they can make payment
var link = resp.RedirectLink();
// Get the poll url of the transaction
var pollUrl = resp.PollUrl();
MessageBox.Show("Payment Suceeds");
}
else
{
MessageBox.Show("Failed");
}
var pollUrli = resp.PollUrl();
var status = paynow.ProcessStatusUpdate(pollUrli);
if (status.Paid())
{
MessageBox.Show("Yay the transction was done");
}
else
{
MessageBox.Show("No transction made");
}