private static void Test_Paystack() { Console.WriteLine("Creating objects....."); Paystack paystack = new Paystack(Environment.GetEnvironmentVariable("paystack_secret")); AuthorisationDetails authorisationDetails = new PaystackAuthorisationDetails { Amount = "150000", Channels = new string[] { "bank", "card" }, Email = "*****@*****.**" }; Console.WriteLine("Getting Authorisation Url....."); var getUrl = paystack.AuthoriseAsync(authorisationDetails).Result; if (!string.IsNullOrEmpty(getUrl.AuthEndpoint)) { Process.Start(new ProcessStartInfo { UseShellExecute = true, Verb = "open", FileName = getUrl.AuthEndpoint }); } else { Console.WriteLine("Model returned null...."); } }
private async void DonationButton_Click(object sender, EventArgs e) { PopUpHelper popUpHelper = new PopUpHelper(); PopupWindow popupWindow = popUpHelper.ShowLoadingPopUp(Context, View); string key = Context.GetString(Resource.String.paystack_secret); //Validate input and key before processing. if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(amountText.Text)) { paystack = new PaystackObject(key); AuthorisationDetails authorisationDetails = new PaystackAuthorisationDetails { Amount = amountText.Text, Channels = new string[] { "bank", "card" }, Email = donorEmailAddress.Text }; ProviderAuthorisationResult authResult = await paystack.AuthoriseAsync(authorisationDetails); try { string path = System.IO.Path.Combine(PathHelper.GetOrCreateAuthDetailsPath(), "auth.exr"); //Important if you need to verify later. await paystack.StoreValuesAsync(authResult, path); Intent intent = new Intent(Context, typeof(TestActivity)); intent.PutExtra(PaystackOptions.PAYSTACK_TRANSFER_KEY, authResult.AuthEndpoint); popupWindow.Dismiss(); StartActivityForResult(intent, 2500); } catch { return; } } }