Search code examples
google-pay

What is the default value of the IsReadyToPayRequest.existingPaymentMethodRequired property?


The existingPaymentMethodRequired property in the IsReadyToPayRequest object is marked as optional but the documentation does not state what the property's default value is.

What value does this property fall back to if I don't specify it?


Solution

  • The existingPaymentMethodRequired property's default value, at the time of writing, is false.

    You can validate this by calling the PaymentsClient.isReadyToPay(request:) method with an IsReadyToPayRequest object which omits the existingPaymentMethodRequired property and with the following setup:

    1. The Google Pay environment is set to PRODUCTION.
    2. The IsReadyToPayRequest.allowedAuthMethods array is set to ["PAN_ONLY","CRYPTOGRAM_3DS"].
    3. Neither your Android device nor your Google account has a payment method added to it.

    You will see that the PaymentsClient.isReadyToPay(request:) method returns true with this setup just as it does when the IsReadyToPayRequest.existingPaymentMethodRequired property is specified and set to false.