-
Notifications
You must be signed in to change notification settings - Fork 2
Performing a Token Pre authorization
James Goodwin edited this page Mar 24, 2017
·
3 revisions
Check that you have initialized the SDK before attempting to make a Token Pre-Authorization.
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 tokenPreAuthPage = new TokenPreAuthPage(judo, viewModel);
Navigation.PushAsync(tokenPreAuthPage);
tokenPreAuthPage.resultHandler += async (sender, result) =>
{
if ("Success".Equals(result.Response.Result))
{
// handle successful token pre authorization
// close token pre authorization page
await Navigation.PopAsync();
}
};