We have implemented Google Pay Push Provisioning API. Currently I am trying to resolve the yellow path as mentioned in this doc.
As a first step to resolve the yellow path, I am trying to use the listTokens
method. This method will return the tokens to the Google Pay wallet via the TokenInfo object, wherein you can chain the getTokenState method to get the token status. The issue is listokens method is always returning an empty array even though we have the cards already available in the wallet.
Initially, the package name was not mapped to the MasterCard, so the result was empty. Later we did the mapping, but still, I am receiving the empty array in the QA and Prod environment.
I wanted to check the package name details in the tokenized response, but when I tried to print the data from intent, I could only see the reference_id.
I need guidance on the two items below.
How do we print the package name details from the tokenize response? I have tried to print the productconfig details from the response, but it looks the details are empty. Is there anything that I am missing on the listtokens API? Below is the implementation:
tapAndPayClient
?.listTokens()
?.addOnCompleteListener {
task - >
if (task.isSuccessful) {
Log.d("LISTTOKENS RESULT", task.result.toString())
for (token in task.result) {
Log.d("LISTTOKENS", "Found token with ID: ${token.issuerTokenId}")
}
result.put("status", true)
pluginCall.resolve(result)
} else {
result.put("status", false)
pluginCall.resolve(result)
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d(WALLETTAG, "onActivityResult Triggered");
if (requestCode == 3) {
Log.d(WALLETTAG, "requestCode 3");
handleTokenizationResult(resultCode, data);
}
}
public void handleTokenizationResult(int resultCode, Intent data) {
Log.d(WALLETTAG, "handleTokenizationResult triggered");
JSObject result = new JSObject();
switch (resultCode) {
case Activity.RESULT_OK:
Log.d(WALLETTAG, "Activity.RESULT_OK");
result.put("status", true);
if (gpayListener != null) {
gpayListener.resolve(result);
}
Log.d(WALLETTAG, data.toString());
Bundle bundle = data.getExtras();
if (bundle != null) {
for (String key: bundle.keySet()) {
Log.d(WALLETTAG, key + " : " + (bundle.get(key) != null ? bundle.get(key) : "NULL"));
}
}
break;
}
}
We need to update the package name in TSP as per the documentation. Once I have updated the package name and ACTION, this API started working fine.