Adil Hussain
Adil Hussain

Reputation: 32221

Unexpected isReadyToPay behaviour when allowedAuthMethods array contains CRYPTOGRAM_3DS only

If I define the allowedAuthMethods array in my IsReadyToPayRequest object as ["CRYPTOGRAM_3DS"] and the user does not have a payment method saved on their device matching allowedCardNetworks but meets all the other minimum requirements, then the PaymentsClient.isReadyToPay(request:) method returns false regardless of the Google Pay environment (i.e. TEST or PRODUCTION) and regardless of the existingPaymentMethodRequired value (i.e. true or false).

Is this expected behaviour?

Given that the PaymentsClient. loadPaymentData(request:) method allows the user to add a card in flow (see screenshot below), I would expect the PaymentsClient.isReadyToPay(request:) method to return true if the existingPaymentMethodRequired property is set to false.

Google Pay sheet screenshot

Upvotes: 0

Views: 652

Answers (1)

Adil Hussain
Adil Hussain

Reputation: 32221

After discussing with a Developer Relations Engineer at Google (@domi), I have come to the conclusion that the behaviour described in my question is undocumented but by design and not a bug.

The existingPaymentMethodRequired property in the IsReadyToPayRequest object only has a bearing on the PaymentsClient.isReadyToPay(request:) result if the allowedAuthMethods array in the IsReadyToPayRequest object contains a "PAN_ONLY" value. Otherwise, the PaymentsClient.isReadyToPay(request:) API will treat the existingPaymentMethodRequired property as having a true value regardless of what value you've actually put there.

The rationale for this is that the Google Pay APIs are able to add a PAN_ONLY card (i.e. a card that's stored on file with the user's Google Account) in flow (i.e. in the Google Pay payment method selection sheet) but they're not able to add a CRYPTOGRAM_3DS card (i.e. a card that's stored on the device as an Android device token) in flow nor are they able to determine whether a CRYPTOGRAM_3DS card can be added on the running device (due to various technical reasons).

Upvotes: 1

Related Questions