Hi, Please refer the info graphic . I'm an issuer Bank App, who wants to add a card to phone's Digital Wallet. When I hit add to Apple or Google wallet, my API call goes to a Token Requester server and then to Token Service provider. In this process, I do get a JWT token back, but when I try to add token to Digital Wallet, I always get the message "The pass cannot be read because it is not valid".
So few question:
- Is there a way to debug the token that is received by the app?
- Is there any kind of API console that I can look to see what is happening and why the pass is not valid?
- I, being the Issuer Bank App, a Token Service Requester and A Token Service Provider, who should be communicating with Apple servers?
- Are there any documents that explicitly shows (example) the flow of adding a credit card to Digital Wallet from iOS perspective?
Any other help is appreciated.
On my end, I have done this:
public void AddToDeviceAsync(string data)
{
try
{
var dataArray = Encoding.UTF8.GetBytes(data);
if (data.Length > 0)
{
if (PKAddPassesViewController.CanAddPasses && PKPassLibrary.IsAvailable)
{
_nsData = NSData.FromArray(dataArray);
ObjCRuntime.Class.ThrowOnInitFailure = false;
_pkPass = new PKPass(_nsData, out NSError e);
if (!string.IsNullOrWhiteSpace(e?.LocalizedDescription))
{
UserDialogs.Instance.AlertAsync(e.LocalizedDescription, AppResources.Alert);
return;
}
if (!PkLibrary.Contains(_pkPass))
{
var controller = new PKAddPassesViewController(_pkPass);
var rootViewController = UIApplication.SharedApplication.Delegate.GetWindow().RootViewController;
if (rootViewController != null)
{
var topController = TopViewControllerWithRootViewController(rootViewController);
topController?.PresentViewController(controller, true, null);
}
}
else
{
UserDialogs.Instance.AlertAsync(AppResources.Pass_Already_Present, AppResources.Alert);
}
}
}
else
{
UserDialogs.Instance.AlertAsync(AppResources.Invalid_Pass_Data, AppResources.Alert);
}
}
catch (Exception e)
{
UserDialogs.Instance.AlertAsync(e.Message, AppResources.Alert);
}
}
Hi @sammatters,
You wrote:
Is there a way to debug the token that is received by the app?
You can decrypt the payload by following the documentation below:
Payment token format reference
https://developer.apple.com/documentation/passkit/payment-token-format-reference
Next, you wrote:
Is there any kind of API console that I can look to see what is happening and why the pass is not valid?
You should be able to add logs to your own servers to analyze the data. There is no public access to the Apple Pay servers beside the exposed endpoints for your requests and responses.
Then, you wrote:
I, being the Issuer Bank App, a Token Service Requester and A Token Service Provider, who should be communicating with Apple servers?
Please see the flow described on the page below:
Apple Pay Demo: Wallet Extensions – Wallet Extensions Flow
https://applepaydemo.apple.com/wallet-extensions#walletExtensionsFlow
Lastly, you wrote:
Are there any documents that explicitly shows (example) the flow of adding a credit card to Digital Wallet from iOS perspective?
Please see the sample code below for an example of the iOS implementation:
Implementing Wallet Extensions
https://developer.apple.com/documentation/passkit/implementing-wallet-extensions
Cheers,
Paris X Pinkney | WWDR | DTS Engineer