'Add card to Google pay

We are implementing Google pay into our bank app. We would like to add a credit card to google pay (wallet). We follow all instructions in doc

we should have a whitelisted card on the Mastercard side and also on one more provider side. And we also get OPC from our BE. And the problem is when I open the wallet modal there is information about the card holder like name, address, phone number ... and when we want to continue wallet tried to contact servers and it shows error message Something went wrong to try it lately and I can not find any error message nothing in Android logcat there is nothing related to.

this is how we create PushTokenizeRequest and how we open in the activity (we are in React-Native module )

private void handleAddToGooglePayClick(String rawData) {
    Log.e(TAG, "==============RAW JSON: " + rawData);
    try {
      JSONObject data = new JSONObject(rawData);
      UserAddress address = getUserAddress(data);
      PushTokenizeRequest pushTokenizeRequest = getPushTokenizeRequest(data, address);
      Log.e(TAG,"ADRESS: "+ address.toString());


        Log.d(TAG, "===================================handleAddToGooglePayClick: OPENING");

        mTapAndPayClient.pushTokenize((Activity) mMainActivityContext, pushTokenizeRequest, REQUEST_CODE_PUSH_TOKENIZE);

    } catch (JSONException e) {
      Log.e(TAG, "handleAddToGooglePayClick JSON: " + e.toString());
    }
  }

  private UserAddress getUserAddress(JSONObject addressData) throws JSONException {
    return UserAddress.newBuilder()
      .setName(addressData.getString("fullName"))
      .setAddress1(addressData.getString("address"))
      .setLocality(addressData.getString("locality"))
      .setAdministrativeArea(addressData.getString("administrativeArea") )
      .setCountryCode(addressData.getString("countryCode"))
      .setPostalCode(addressData.getString("postalCode"))
//      .setPhoneNumber(addressData.getString("phone"))
      .setPhoneNumber("+4915223433333")
      .build();
  }

  private PushTokenizeRequest getPushTokenizeRequest(JSONObject generalData, UserAddress userAddress) throws JSONException {
    String opc = generalData.getString("opc");

    byte[] opcBytes = opc.getBytes();

    return new PushTokenizeRequest.Builder()
      .setOpaquePaymentCard(opcBytes)
      .setNetwork(TapAndPay.CARD_NETWORK_MASTERCARD)
      .setTokenServiceProvider(TapAndPay.TOKEN_PROVIDER_MASTERCARD)
      .setDisplayName(generalData.getString("displayName"))
      .setLastDigits(generalData.getString("cardLastFourDigit"))
      .setUserAddress(userAddress)
      .build();
  }


}

all seems to be right. All data from JSON are there and I can see them in a form in the wallet modal.

and OPC is base64 string and when we decode it we get the object:

{
   "fundingAccountInfo":{
      "encryptedPayload":"7B227075626C696...very long hash"
   },
   "tokenizationAuthenticationValue":"eyJ2ZXJza...very long hash"
}

and inside tokenizationAuthenticatioValue we have some data in base64:

{
   "version":"3",
   "signatureAlgorithm":"RSA-SHA256",
   "dataValidUntilTimestamp":"2021-09-13T15:30:46Z",
   "includedFieldsInOrder":"dataValidUntilTimestamp|accountNumber|financialAccountInformation",
   "signature":"T35Y2u+3DZJ.......Tbw=="
}

I think this OPC object is wrong we can not find exactly what should be there.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source