(narrator) With the Google Pay API for Android,
you can facilitate payment transactions for your users,
making the checkout experience in your application more convenient.
Join other businesses like yours who are using Google Pay today
to drive user growth, increase conversions,
and reduce data exposure and transaction vulnerabilities.
Here is how you can integrate Google Pay
on your Android application in four simple steps:
configure your project;
determine readiness to pay;
show the Google Pay button;
create a
First, add the Google Pay library to the list of
in your application module.
Make sure to review our documentation to check the latest version available.
You also need to enable the Google Pay API in your
You can do that by adding the following tag
inside of your application node.
As soon as you are ready,
open the activity where you plan to show the Google Pay button
and obtain a new instance of the
inside of your
Note that the
Use the definitions in this class to specify the environment
in which you want to operate,
TEST
For the
You can play with the API yourself and integrate into your application.
In this case, you can use real payment information.
However, whenever a selection is made, we return you a non-chargeable token.
Remember, your real card details are never used when in
but you must add at least one chargeable card to your Google account
before you proceed.
Once you complete the integration and you are ready to handle real payments,
come and register with us through our self-service portal
and then flip the environment to
You can apply for production access
on
Now that you have your
the first API you need to call is
With
you can determine whether the user has a valid payment method on file
and is capable of completing a transaction on a supported device.
This request takes parameters that specify the API version
targeted in your call,
as well as the payment methods allowed for this transaction.
At Google, we focus on optimizing for conversions,
so if
we highly recommend
that you do not show the Google Pay button.
Now that you know that the user is ready to make a payment using Google Pay,
you can make the button visible to the user.
We recommend that you use the graphic shared in the developer documentation
to ensure the Google Pay branding is used correctly
per our latest guidelines.
In this bundle,
you will find drawable and layout resources
that adapt to different screen sizes and resolutions,
as well as translations into multiple languages
for the text in the button.
Once the user taps on the button,
you call the
to open up the payment sheet.
You can construct the
which is a set of payments configurations used for this particular transaction.
You can request additional information,
like a shipping address and email address,
in addition to the payment credentials.
We recommend that you collect as little information as necessary
to prevent users from typing additional information
which might not be stored in their accounts.
One more point to call out in this object
is the
Google encrypts information about a user's selected card
for secure processing by a merchant's gateway
or directly on a merchant's secured servers.
Be sure to check your processor's integration guidelines
to find out what they need to finalize the payment.
Now that you've constructed the
you can pass it to
an asynchronous task which opens the payments sheet.
Once the user makes a selection,
we return to you a
which consists of metadata about the user's selection.
It also includes the payment token
which you can use to complete the transaction.
Now you can send the final production-ready application to Google
for a final test.
Google tests the app with real cards
and informs you if everything is correct.
The app is then cleared to launch.
You can find additional information in our developer documentation
on
Don't miss any future videos about Google Pay and Android,
and subscribe to the Android Developers channel.
If you are watching on a mobile,
tap the little bell to receive new upload notifications.
See you soon!