The Google Pay Merchant SDK (or Google Pay SDK) is a toolkit that enables developers to integrate their applications with Google Pay for accepting payments online. Users making purchases on the developers’ apps can make payments easily and conveniently.
The SDK can be integrated directly by the merchant into their app, or it may be bundled into the SDK provided by their Payment Gateway (PG) . If you are a merchant with an existing PG SDK, check with your PG if the Google Pay SDK functionality can be provided within that PG SDK.
High level Google Pay SDK flow
- Merchant app integrated with Google Pay SDK calls the
IsReadyToPay
API to check if the user device is ready to pay with Google Pay. Assume the device is ready. - Merchant app calls the
loadPaymentData
API with the required input, which is passed on to Google Pay. - Google Pay user selects from available payment methods, and authenticates the payment. The Google Pay server backend is called with instructions to execute the payment.
- The Google Pay server makes the payment call, either to the merchant’s PG or to the user’s PSP (Payment Service Provider). The former is used for card payments and for merchants who have UPI payments set up through their PG, while the latter is for cases where the merchant wants to integrate with UPI directly through Google Pay.
- The payment status is returned to the Google Pay server.
- The Google Pay client receives the state, and displays it in the UI that is rendered on the merchant app.
The Google Pay SDK reverts control to the merchant app. In cases where the merchant’s PG has provided a response bundle for the merchant, this is included in the
gatewayResponse
field.- The Google Pay response can be used for an initial check of payment parameters such as the amount, transaction ID, and payee VPA.
To check the payment status, the merchant needs to do the following:
- Verify the authenticity of
gatewayResponse
, if the field is populated. - Call their PG or acquiring PSP for status, if the
gatewayResponse
field is not populated.
- Verify the authenticity of
The merchant displays the payment status and next steps for fulfilment in the merchant app.