-
Notifications
You must be signed in to change notification settings - Fork 2
Performing a Token Payment
James Goodwin edited this page Mar 24, 2017
·
3 revisions
Check that you have initialized the SDK before attempting to make a Token Payment.
Using the PaymentReceiptModel
returned from registering a card, create the TokenPaymentDefaultsViewModel
:
var cardType = (CardNetwork)Enum.Parse(typeof(CardNetwork), receipt.CardDetails.CardType.ToString());
var lastFour = receipt.CardDetails.CardLastfour;
var expiryDate = receipt.CardDetails.EndDate;
var token = receipt.CardDetails.CardToken;
var consumerToken = receipt.Consumer.ConsumerToken;
var consumerReference = receipt.Consumer.YourConsumerReference;
var viewModel = new TokenPaymentDefaultsViewModel(lastFour, expiryDate, token, consumerToken, cardType);
Note: Please make sure that the Consumer Reference used and the card token matches the ones used when the card token was originally generated.
var tokenPaymentPage = new TokenPaymentPage(judo, viewModel);
Navigation.PushAsync(tokenPaymentPage);
tokenPaymentPage.resultHandler += async (sender, result) =>
{
if ("Success".Equals(result.Response.Result))
{
// handle successful token payment
// close token payment page
await Navigation.PopAsync();
}
};