Token payment

James Lappin edited this page Aug 22, 2017 · 6 revisions

Create an intent for the Payment Activity with the required extras (the details in the following snippet are dummy data – use the data for your account instead):

To do token payment you will need to store and retrieve two fields from the original receipt. These fields are the card token and the consumer token.

var cardToken = originalReceipt.CardDetails.CardToken;
var consumerToken = originalReceipt.Consumer.ConsumerToken;

You will need to provide the same "YourConsumerReference" as well as the fields retrieved above to complete a token payment.

var tokenPaymentModel = new TokenPaymentModel
{
    //the value of the payment
    Amount = 1.01m,
    Currency = "GBP",

    // the card details
    CardToken = cardToken,
    CV2 = "452",

    // identify the recipient
    JudoId = YOUR_JUDO_ID,

    // provide an identifier for your customer
    ConsumerToken = consumerToken,
    YourConsumerReference = yourConsumerReference,
};

var response = await client.Payments.Create(tokenPaymentModel);
if (response.HasError)
{
    // Your error handling should go here.
    // You can see more detailed about the error by looking at response.Error
}

var receipt = response.Response as PaymentReceiptModel;
if (receipt != null)
{
    // Deal with a successful payment.
    Console.WriteLine("Payment successful. Transaction Reference {0}", receipt.ReceiptId);
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.