I would like to create a payment method in my Android app, like the one in Google Photos: I want to ask the shipping address and update dynamically the shipping cost according to the country.
I follow the Google Pay documentation but it doesn't give any explanation of how to set the callbacks like, for example, is explained in the Google Pay web documentation. I also tried to look for some tutorials but seems that no one tried to do what I'm trying to do.
For example I would like to show an error like this picture
When I try to create the JSON to add the callback, Google pay crashes without giving any log, neither with adb -d logcat -s WalletMerchantError
JSONObject paymentDataRequestJSON = new JSONObject()
.put("apiVersion", 2)
.put("apiVersionMinor", 0)
.put("allowedPaymentMethods", new JSONArray()
.put(cardPaymentMethod))
.put("transactionInfo", transactionInfo)
//.put("merchantInfo", merchantInfo) // TODO
.put("callbackIntents", new JSONArray()
.put("SHIPPING_ADDRESS")
.put("SHIPPING_OPTION"))
.put("shippingAddressRequired", true);