Skip to content

Performing a Payment

James Goodwin edited this page Mar 24, 2017 · 14 revisions

Check that you have initialized the SDK before attempting to make a payment.

1. Configuring the Judo instance

var judo = new Judo()
{
    JudoId = "<JUDO_ID>",
    ApiToken = "<API_TOKEN>",
    ApiSecret = "<API_SECRET>",
    Environment = JudoEnvironment.Sandbox,
    Amount = 1.50m,
    Currency = "GBP",
    ConsumerReference = "YourUniqueReference"
};

Note: Please make sure that you are using a unique Consumer Reference for each different consumer.

2. Create a PaymentPage to show the card entry screen

var paymentPage = new PaymentPage(judo);
Navigation.PushAsync(paymentPage);

3. Receive the payment result

paymentPage.resultHandler += async (sender, result) =>
{
    if ("Success".Equals(result.Response.Result))
    {
        // handle successful payment

        // close payment page
        await Navigation.PopAsync();
    }
};