PaymentDataRequest.FromJson GooglePay fails to create allowedAuthMethods and allowedCardNetworks
Xamarin.GooglePlayServices.Wallet (71.1600.1) Visual Studio for Mac: 8.6.2 (Build 6)
Using the following json that is a direct copy from the GooglePay website for the json format of a PaymentDataRequest. Pass this string into PaymentDataRequest.FromJson and none of the member properties in the returned PaymentDataRequest are set (they are all null)
If I use the now deprecated "Builder" methods, the PaymentDataRequest has the class members correctly filled in.
{
"apiVersion": 2,
"apiVersionMinor": 0,
"merchantInfo": {
"merchantName": "Example Merchant"
},
"allowedPaymentMethods": [
{
"type": "CARD",
"parameters": {
"allowedAuthMethods": ["PAN_ONLY", "CRYPTOGRAM_3DS"],
"allowedCardNetworks": ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"]
},
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "example",
"gatewayMerchantId": "exampleGatewayMerchantId"
}
}
}
],
"transactionInfo": {
"totalPriceStatus": "FINAL",
"totalPrice": "12.34",
"currencyCode": "USD"
}
}
Well I'm not GooglePay expert, so minimal project to repro would help to see what is going on. Whether this is bindings or something else.
Hi @moljac and @ZooteeMan
If you convert back the resulting PaymentDataRequest (with the null values) to Json you can see the original Json in the resulting string so even if the properties weren't populated the object seems to contain the Json string.
I believe Google want us to interact directly with Json so those properties are deprecated thus not being populated from the FromJson method. Instead you need to always access those values from the Json itself.
I have been able to create the requests from Json but haven't been able to make it work since passing IsPaymentRequest to IsReadyToPayRequest keeps returning false so I'm not sure if this might be related to the properties or not.
Have there been any updates in your research?
I was able to make it work using Json objects. As my original answered suggested this doesn't seem to be an issue and just how Google want us to implement Google Pay. The reason the properties are not filled with the data is because they have been deprecated. cc @moljac @ZooteeMan
Here is a nice tutorial on how to make it work: https://developers.google.com/pay/api/android/guides/tutorial#java
Using Json Object does not work either. I also tried using deprecated Build() method but there is no method to pass MerchantInfo and I get "The merchant is not enabled for Google Pay". Is this because "GooglePayServiceComponents" are older or this binding library has not been up to date with "com.google.android.gms". Please, help if anyone has resolved this issue.