User experience best practices

Consider these guidelines for the following scenarios when you integrate with the Google Pay API. The scenarios depend on your buyflow and user experience (UX).

You provide shipping

If you provide shipping, set shippingAddressRequired to true and customize shippingAddressParameters in your PaymentDataRequest object. This way, users can select or modify a shipping addresss at the same time that they select or modify their payment information.

You set existingPaymentMethodRequired

If you set existingPaymentMethodRequired set the user's payment method at checkout to default to Google Pay when IsReadytoPay returns true. With existingPaymentMethodRequired set to true, IsReadytoPay only returns true for users who either already have a card on file in their Google account, or already have a tokenized card provisioned in their Google Pay app. It depends on your customizations.

You have an item view

If you have an item view, integrate and display Google Pay on the item listing page so that the user can easily select their payment information with Google Pay and complete the purchase from that page. You can set Google Pay as the default when IsReadytoPay returns true.

You have a cart view

If you have a cart view, integrate with the API and display Google Pay so that the user can easily see all of the items within the cart, as well as a final, total associated price. You can set Google Pay as the default when IsReadytoPay returns true.

You have Guest Checkout

If you have Guest Checkout, integrate with the API and specify in your request what information you need in order to create an account. For example, the Google Pay API can return an email address when you set emailRequired to true in your PaymentDataRequest object, or the API can return a name when you set billingAddressRequired to true in CardParameters and define the billingAddressParameters .

You have a wallet view

If you have a wallet view, ensure that you've customized your IsReadyToPay request in this view to match your IsReadytoPay request in your buyflow. For example, if you've set existingPaymentMethodRequired in your IsReadytoPay request for your buyflow, your wallet screen has the same parameter set. If your IsReadytoPay request is customized to request PAN_ONLY in allowedAuthMethods of your PaymentDataRequest object, your wallet screen has the same parameter customization.

You charge for subscriptions

If you charge for subscriptions, integrate with the API and allow users to change the backing payment instrument within Google Pay anytime.

You charge immediately after you invoke Google Pay

If you charge immediately after you invoke Google Pay, ensure that a final, total associated price is shown to the user before you invoke Google Pay.Then, set CheckoutOption to COMPLETE_IMMEDIATE_PURCHASE so that users see a Pay button within the Google Pay chooser. This customization bypasses a traditional confirmation screen before the user is charged.

You want to use data returned from the API for purposes other than transactions

If you'd like to use any data returned by the Google Pay API for any purpose other than a transaction, you must obtain separate, express consent from the user.

For example, the Google Pay API can return an email address when you set emailRequired to true in your PaymentDataRequest object. If you wish to use this email address for mailing list purposes, you need to get separate, express consent from the user, and you must request it from the user outside of the purchase flow.

Otherwise, data returned by the Google Pay API is used only for transaction purposes, which include order confirmation, shipping notifications, shipping tracking, cancellations, refunds, and refund notifications.