This topic gives step-by-step instructions to integrate Google Pay with the In-App Payments SDK on an Android device.
Enable Google Pay
To enable Google Pay with the In-App Payments SDK on Android, the following must be true:
You're a US, Canadian, UK, or AU Square seller. Google Pay for the In-App Payments SDK is only available for Square sellers based in the United States, Canada, the United Kingdom, or Australia.
You've followed the instructions in Build on Android. This topic doesn't cover the general setup of the In-App Payments SDK.
The Google Pay application must be installed on the Android devices that your application is distributed to.
The device user must have added a Square-supported payment method to Google Pay.
- Add the Google Pay binary dependency to the build.gradle file of your
- Update your AndroidManifest.xml file to include the following
Add a clickable item to your activity layout for starting a Google Pay payment. In step 4, add an
onClickListener callback to this control.
Declare the following fields as private
Copy a location ID from your application Locations page in the Developer Dashboard.
Paste your Sandbox location ID to replace the placeholder
"LOCATION_ID"as the value of
Create a Google Pay payments client that is configured for a test environment. For more information about creating a client, see Google Pay tutorial.
Set the Google Pay button
YOUR_ACTIVITY_CLASS_NAMEwith the type name of your activity and the
YOUR_LOCATION_IDstring in the example code with a valid Square location ID. The available location IDs for a Square account can be found on the Locations page of the Square Developer Dashboard.
Request the "ready to pay" status and enable the Google Pay button if you're ready to pay. For more information about getting the pay status, see Google Pay tutorial.
To test your Google Pay integration, you must register a valid credit card in Google Pay.
When your Google Pay integration has passed your test procedures and you're ready to distribute your application in a production environment, complete the following tasks:
Complete the Google Pay Integration Checklist. If you've integrated Google Pay as described in the setup guide, the exit criteria for basics and branding testing checklist items are met. The exit criteria for Functional testing checklist items 4–9 can only be met by your application logic.
- The Tokenization Method must be gateway.
- The Payment Processor or Gateway form field must contain square.
Replace your step 3 Sandbox application ID and location ID with production values.
Set the client environment to production by using
To add security to a payment method, you can add the 3D Secure security protocol layer to the application. 3D Secure integrates Strong Customer Authentication (SCA) to verify the identity of the payment card holder by using the
verifyBuyer function. For more information, see 3D Secure Overview.