Google Pay
Google Pay™ lets customers pay with the cards saved in their Google account - a fast, native checkout experience. The MoneyHash SDK provides the configuration needed to initialize the Google Pay button: you render the button, Google handles the authorization sheet, and the encrypted token is submitted to MoneyHash to complete the payment. This page covers the full integration on every platform - Web (JavaScript), Android, Flutter, and React Native.
How it works
Whatever the platform, Google Pay is the same three moves: get the Google Pay configuration from MoneyHash, get an encrypted token from Google, and submit that token back to MoneyHash. The difference is how much the SDK does for you:
- Web - you render Google's button element and configure its payment request from
nativePayData; when the customer authorizes, you submit the token withproceedWith+submitPaymentReceipt. - Android · Flutter · React Native - after selecting Google Pay on the intent, one call presents the sheet and submits the token for you (
proceedWithGooglePayon Flutter/React Native, theGooglePayLauncheron Android) and resolves with the final intent details.
Four parties touch a Google Pay payment, and each holds exactly one piece. Your app owns the button and the checkout UI - nothing sensitive. Google Pay authenticates the customer and answers with an encrypted payment token; the tokenization spec (gateway + gatewayMerchantId) determines who can decrypt that token - the gatewayMerchantId is the merchant identifier at the gateway used in the encryption (your merchant id at the underlying provider such as Checkout, or your MoneyHash merchant id, depending on the connection) - so the real card number is never exposed to your code. MoneyHash supplies the configuration the button needs (nativePayData, straight from your Google Pay connection) and is the only party that can turn the token into money - it decrypts it server-side and routes the charge to your provider.
Step by step, a payment looks like this:
- Your backend creates a payment intent
- The SDK retrieves the Google Pay configuration via
getMethods - You render the Google Pay button using the returned
nativePayData - The customer selects a card in the Google Pay sheet and authorizes
- Google returns an encrypted payment token
- The token is submitted to MoneyHash - explicitly on the web (
proceedWith+submitPaymentReceipt), automatically on mobile - MoneyHash processes the payment and delivers webhooks
In sequence form - on the web, you drive the button and submit the token yourself:
On Android, Flutter, and React Native, the SDK presents the sheet and submits the token in one call:
Prerequisites
- A Google Pay connection configured and completed in your MoneyHash dashboard - enabling Google Pay is a property of the connection, not of your MoneyHash account. The allowed networks, auth methods, and country the SDK returns in
nativePayDataall come from this connection. - The gateway merchant identifier - used as
gatewayMerchantIdin the Google Pay tokenization spec. This is the merchant id at the gateway that decrypts the token (e.g. your merchant id at the underlying provider such as Checkout, or your MoneyHash merchant id, depending on the connection). It is returned automatically innativePayData- never hardcode it. - A registered Google Pay merchant ID
- Web only: HTTPS enabled on your domain, and your domain registered in the Google Pay Console for production use
Dashboard configuration
Before integrating, configure Google Pay in the MoneyHash dashboard:
| Setting | What it does |
|---|---|
| Allowed card networks | The supported schemes - Visa, Mastercard, Amex, Discover, JCB, Mada, etc. |
| Allowed auth methods | PAN_ONLY for standard cards, CRYPTOGRAM_3DS for 3DS-enabled cards |
| Google Pay country | The country where payments are processed |