Search code examples
androidgoogle-pay

Google Pay - Callbacks on Shipping Address or Shipping Method Change


  1. Is there a way where we can get callbacks in whenever user changes it's shipping address or shipping method in Google Pay Android SDK?
  2. Is there a way where we can get shipping address before showing Google Pay Sheet? That is required to fetch respective shipping Options available for that shipping address
registerForActivityResult(TaskResultContracts.GetPaymentDataResult()) { taskResult -> 
    when (taskResult.status.statusCode) {
       //.. Receive callback whenever full payment is done
    }
}

I see that Google Web API has onPaymentDataChanged whenever OFFER, SHIPPING_ADDRESS Or SHIPPING_OPTION is changed. But I don't see any similar callbacks in Android SDK other than above where I am not receiving any callbacks. Infact I don't see direct way of adding ShippingOptions as well in Android SDK which I added by referring to Web API ShippingOptionParameters

Referring to com.google.android.gms:play-services-wallet:19.3.0

Trying with WalletConstants.ENVIRONMENT_TEST as Production access it not yet available.


Solution

  • Your observations are correct. The Google Pay API on Android currently does not support callbacks.