Google Pay™ is a mobile payment and digital wallet service by Google that enables seamless online checkout experiences for payers, in Android apps and on the mobile web, using payment methods saved to a Google account or Android device. Google Pay is a supported device payment in the Mastercard Payment Gateway.
This page describes the processing specific to Google Pay device payments. It's recommended that you read the integration guidelines for device payments, before building your Google Pay integration.
The Mastercard Payment Gateway offers Google Pay from API v47 onwards.
To accept Google Pay payments:
You can integrate Google Pay into your mobile app or the checkout page of your website using Direct Payment.
If you want to take the responsibility of decrypting the payment token on your server, see Decrypting the Payment Token.
tokenizationSpecification
object of the Google Pay API: type
): Set this to PAYMENT_GATEWAY
gateway
): Set this to mpgs
gatewayMerchantId
): A unique merchant identifier that the gateway can use to verify and identify the merchant when decrypting the payment token. This merchant identifier must be the same as your merchantId
submitted on your gateway's API request.On completion of the payer's interaction with the Google Pay user interface, you will be provided with a payload that contains an encrypted payment token signed by Google. The payment token will be issued for either a device payment or a card payment.
allowedAuthMethods
to PAN_ONLY
in the allowedPaymentMethods
object of the Google Pay API.Check Enrollment
request.order.walletProvider
=GOOGLE_PAY
sourceOfFunds.provided.card.devicePayment.paymentToken
: The encrypted payment token obtained from the Google Pay SDK.The gateway will decrypt the payment token, and if it contains an FPAN then 3DS Check Enrollment
request will proceed. If the payment token contains a DPAN, the request is rejected (3DS authentication is not supported for DPANs). For more information on how to integrate to the gateway using 3DS, see 3D Secure Authentication.
Authorize
/Pay
or an Update Session
request.order.walletProvider
=GOOGLE_PAY
order.amount
: The value you provide must be the final amount of the order (including shipping and other additional amounts).order.currency
sourceOfFunds.provided.card.devicePayment.paymentToken
: The encrypted payment token obtained from the Google Pay SDK.sourceOfFunds.provided.card.devicePayment.paymentToken [REST][NVP]
In addition to the standard fields, the following response fields are returned for a successful authorization using the payment token.
If the payload contained a DPAN (for device payments):
sourceOfFunds.provided.card.encryption
=DEVICE
sourceOfFunds.provided.card.deviceSpecificNumber
: The DPAN in masked format.sourceOfFunds.provided.card.deviceSpecificExpiry.month
sourceOfFunds.provided.card.deviceSpecificExpiry.year
sourceOfFunds.provided.card.number
: The FPAN in masked format.sourceOfFunds.provided.card.expiry.month
sourceOfFunds.provided.card.expiry.year
sourceOfFunds.provided.card.devicePayment.cryptogramFormat
If the payload contained an FPAN (for Google Pay digital wallet payments):
sourceOfFunds.provided.card.encryption
=DIGITAL_WALLET
sourceOfFunds.provided.card.number
: The FPAN in masked format.sourceOfFunds.provided.card.expiry.month
sourceOfFunds.provided.card.expiry.year
Here's a sample Authorization Request in REST where payment token is decrypted by the gateway.
URL | https://evopaymentsmexico.gateway.mastercard.com/api/rest/version/72/merchant/{merchantId}/order/{orderid}/transaction/{transactionid} |
HTTP Method | PUT |
{ "order": { "amount": "1500", "currency": "USD", "walletProvider": "GOOGLE_PAY" }, "apiOperation": "AUTHORIZE", "sourceOfFunds": { "type": "CARD", "provided": { "card": { "devicePayment": { "paymentToken": "{\r\n \"protocolVersion\": \"ECv1\",\r\n \"signature\": \"MEYCIQDoEflyImKP5GB4qsZr\/7FEOejsYL5dVhhFr5j0qwRScwIhAJfu2csV+34nZlBVs65\/PlhoXO4j6t9ymEb8ER2tyenb\",\r\n \"signedMessage\": \"{\\\"encryptedMessage\\\":\\\"dPHXSxxmUq6DybXPIv9s+RfHsLcrGkIT7VWkjtK0hrecsR5mqDnC2ZlttivkKTxA31AA1PyTfBk82OXjmMVXCK+BXqRXsOKdFD7TzZs8gTGHXrnyCIRneXLRxL65EM9TXKc\/RknvKe2fWnZ2FE8kx3Sgu2\/1ae6xUr7huWlHJhX2xXhp+tb5xzQLGeTh+vQVeA9fTtgdmi6JnmoxRCk\/mwNGbSNEh8NyJ\/XddHBOZvsOmRgdAtPc1evxzWnLZqfDM7C5HQtHgkZlf+Gz8tPkcHmvz3UCSuVMfdM=\\\",\\\"ephemeralPublicKey\\\":\\\"BPpn0+yk4+F\/qcPKwyUdPpBTz\/FDcW\/SKeNCZkEOqAYoweO3oRXVYv+0jSEN\/5RKUxWCzC12WmVvdBzbQlK7zRo=\\\",\\\"tag\\\":\\\"6pa1DwNifczCELtCQRqPZEshl2lQGr\/a1PiKUNuoaew=\\\"}\"\r\n}" } } } } }
{ "gatewayEntryPoint": "WEB_SERVICES_API", "merchant": "TESTWTFA5B7749", "order": { "amount": "1500.00", "authenticationStatus": "AUTHENTICATION_NOT_IN_EFFECT", "creationTime": "2022-03-26T03:48:17.403Z", "currency": "USD", "id": "7181c33b-a7f6-42c5-acdf-fc3bd0bfb7f4", "lastUpdatedTime": "2022-03-26T03:48:17.571Z", "merchantCategoryCode": "1234", "merchantAmount": "1500.00", "merchantCurrency": "USD", "status": "AUTHORIZED", "totalAuthorizedAmount": "1500.00", "totalCapturedAmount": "0.00", "totalDisbursedAmount": "0.00", "totalRefundedAmount": "0.00", "walletProvider": "GOOGLE_PAY", "chargeback": { "amount": "0", "currency": "USD" } }, "response": { "acquirerCode": "706", "gatewayCode": "APPROVED", "gatewayRecommendation": "NO_ACTION" }, "result": "SUCCESS", "timeOfLastUpdate": "2022-03-26T03:48:17.571Z", "timeOfRecord": "2022-03-26T03:48:17.462Z", "sourceOfFunds": { "type": "CARD", "provided": { "card": { "brand": "AMEX", "encryption": "DIGITAL_WALLET", "fundingMethod": "CREDIT", "number": "345678xxxxx4564", "scheme": "AMEX", "storedOnFile": "NOT_STORED", "expiry": { "month": "1", "year": "39" } } } }, "transaction": { "amount": "1500.00", "authenticationStatus": "AUTHENTICATION_NOT_IN_EFFECT", "authorizationCode": "331482", "currency": "USD", "id": "2f9ea2bd-1b70-47e2-b2af-2528d83f6ee7", "receipt": "2203261", "source": "INTERNET", "stan": "1", "terminal": "11111", "type": "AUTHORIZATION", "acquirer": { "batch": "1", "id": "EAS_TESTACQ", "merchantId": "123456" } }, "version": "63" }
You can choose to decrypt the payment token on your server instead of providing the payment token for decryption to the gateway. In this case, you will need to take responsibility for storing the encryption credentials and executing the decryption.
Google Pay JSON Key |
Corresponding API Request Field |
Description |
---|---|---|
pan | sourceOfFunds.provided.card.number | The device-specific primary account number (DPAN) of the card that funded this transaction. |
expirationMonth | sourceOfFunds.provided.card.expiry.month | The expiration month of the pan. |
expirationYear | sourceOfFunds.provided.card.expiry.year | The expiration year of the pan. |
authMethod | sourceOfFunds.provided.card. devicePayment.cryptogramFormat |
The cryptogram format. Set this to 3DSECURE. |
cryptogram | sourceOfFunds.provided.card.devicePayment. 3DSecure.onlinePaymentCryptogram |
Cryptogram in 3DSecure format. |
eciIndicator | sourceOfFunds.provided.card.devicePayment. 3DSecure.eciIndicator |
Provide the electronic commerce indicator (ECI), if available. |
sourceOfFunds.provided.card.nameOnCard | (Optional)The cardholder's name. | |
order.currency | The ISO 4217 currency code for the transaction. | |
order.amount | The order amount. |
Check Enrollment
request.order.walletProvider
=GOOGLE_PAY
sourceOfFunds.provided.card.number
: See table below.For more information on how to integrate to the gateway using 3DS, see 3D Secure Authentication.
Google Pay JSON Key |
Corresponding API Request Field |
Description |
---|---|---|
pan | sourceOfFunds.provided.card.number | The card number (FPAN) of the card that funded this transaction. The payload contains an FPAN when the payer chooses to pay using a card saved to their Google Play account. Note that for card payments, capturing CSC is currently not supported by the Google Pay API. |
expirationMonth | sourceOfFunds.provided.card.expiry.month | The expiration month of the pan. |
expirationYear | sourceOfFunds.provided.card.expiry.year | The expiration year of the pan. |
sourceOfFunds.provided.card.nameOnCard | (Optional)The cardholder's name. | |
order.currency | The ISO 4217 currency code for the transaction. | |
order.amount | The order amount. |
PAYER_TERMINAL_OFF_PREMISES
or PAYER_TERMINAL_ON_PREMISES
. If you do not provide a value, PAYER_TERMINAL_OFF_PREMISES
is used.Here's a sample Authorization Request in REST where the values from the decrypted payment token are provided to the gateway.
{ "apiOperation": "AUTHORIZE", "order": { "amount": "30.10", "currency": "INR", "walletProvider": "GOOGLE_PAY" }, "sourceOfFunds": { "provided": { "card": { "expiry": { "month": "01", "year": "39" }, "number": "5123450000000008", "devicePayment": { "cryptogramFormat": "3DSECURE", "3DSecure": { "onlinePaymentCryptogram": "IA/8pdiWftSsxpFT6wABoDABhgA=", "eciIndicator": "20" } } } }, "type": "CARD" }, "device": { "ani": "12341234" }, "transaction": { "source": "INTERNET" } }
{ "authorizationResponse": { "commercialCard": "123", "commercialCardIndicator": "1", "date": "0330", "financialNetworkCode": "MCC", "posData": "1025104006600", "posEntryMode": "812", "processingCode": "003000", "responseCode": "00", "stan": "290026", "time": "220509", "transactionIdentifier": "865442937", "transactionIntegrityClass": "A1" }, "device": { "ani": "12341234" }, "gatewayEntryPoint": "WEB_SERVICES_API", "merchant": "LOVECRAFTS2I", "order": { "amount": 30.10, "authenticationStatus": "AUTHENTICATION_NOT_IN_EFFECT", "certainty": "ESTIMATED", "chargeback": { "amount": 0, "currency": "INR" }, "creationTime": "2022-03-30T22:05:09.395Z", "currency": "INR", "id": "09765d59-cdd8-432c-96c9-d6ae91588251", "lastUpdatedTime": "2022-03-30T22:05:09.857Z", "merchantAmount": 30.10, "merchantCategoryCode": "1234", "merchantCurrency": "INR", "status": "AUTHORIZED", "totalAuthorizedAmount": 30.10, "totalCapturedAmount": 0.00, "totalDisbursedAmount": 0.00, "totalRefundedAmount": 0.00, "walletProvider": "GOOGLE_PAY" }, "response": { "acquirerCode": "00", "acquirerMessage": "Approved", "gatewayCode": "APPROVED" }, "result": "SUCCESS", "sourceOfFunds": { "provided": { "card": { "brand": "MASTERCARD", "devicePayment": { "cryptogramFormat": "3DSECURE" }, "deviceSpecificExpiry": { "month": "1", "year": "39" }, "deviceSpecificNumber": "512345xxxxxx0008", "fundingMethod": "UNKNOWN", "number": "xxxxxxxxxxxxxxxx", "scheme": "MASTERCARD", "storedOnFile": "NOT_STORED" } }, "type": "CARD" }, "timeOfLastUpdate": "2022-03-30T22:05:09.857Z", "timeOfRecord": "2022-03-30T22:05:09.410Z", "transaction": { "acquirer": { "batch": 20220330, "date": "0330", "id": "SYSTEST_ACQ_S2I", "merchantId": "123463", "transactionId": "865442937" }, "amount": 30.10, "authenticationStatus": "AUTHENTICATION_NOT_IN_EFFECT", "authorizationCode": "112233", "currency": "INR", "id": "1", "receipt": "208922290026", "source": "INTERNET", "stan": "290026", "terminal": "CBAS2I02", "type": "AUTHORIZATION" }, "version": "63" }
If you are decrypting the payment token, you must get your integration approved by Google. Follow the instructions supplied by Google here: Android/Web.
However, before submitting your integration for approval to Google, you must complete some test transactions. You can test your integration with the gateway in production using your test merchant profile and a supported DPAN or an FPAN. For more information, refer to Test with sample tokens.
If you are testing for a device payment (card saved to your Android device), use a supported DPAN from the following table.
Scheme |
DPAN |
Expiry Date |
---|---|---|
Visa | 4895370012003478 | 12/2027 |
American Express | 370295136149943 | 12/2027 |
If you are testing for a card payment (card saved to your Google Play account), use the supported FPAN from the following table.
Scheme |
FPAN |
Expiry Date |
---|---|---|
Visa | 4111111111111111 | 12/2027 |
Once your integration is approved by Google, you must perform final production verification testing before going live.
If the gateway decrypts the payment token, your app needs to specify the gateway ("mpgs") as your payment service provider. This information is needed to allow the payment token generated by Google to be encrypted using the gateway's public key.
To perform test transactions, you must use your gateway production Merchant ID in production — the test gateway Merchant ID is unable to decrypt payment tokens.
If the transactions are either APPROVED or DECLINED then the gateway was able to process your test transactions successfully.
The Mobile SDK assists you to develop a mobile application (app) that will accept digital payments via the Mastercard Payment Gateway. The gateway offers support for Google Pay via the Mobile SDK. Click here for the Mobile SDK integration guidelines for the Android platform.
Copyright © 2022 Mastercard