Add Google Pay to your website so customers can seamlessly and securely pay you using a card connected to their Google account.
To accept Google Pay, first complete some initial setup with Google. Then configure the Google Pay button on your checkout, and use the Google Pay response to create charges with Pin Payments.
Follow the Google Pay for Web documentation, ensuring your integration meets the requirements outlined in the Google Pay Web integration checklist and Google Pay Web brand guidelines.
When a customer on your website presses the payment button, submit a payment data request to the Google API with the following parameters:
'gateway': 'pinpayments'
'gatewayMerchantId': '<your merchant token>'
Your merchant token is displayed in the Google Pay section of your dashboard.
For example:
'allowedPaymentMethods': ['CARD','TOKENIZED_CARD'],
'paymentMethodTokenizationParameters': {
'tokenizationType': 'PAYMENT_GATEWAY',
'parameters': {
'gateway': 'pinpayments'
'gatewayMerchantId': ''
}
}
Once you have received the payment data from Google, you then need to call the Pin Payments create payment source endpoint to tokenise the encrypted payment data. You can find this payment data in the paymentMethodToken
property of the Google Pay payment data request’s response.
To find out more about Google Pay payment requests, read the Google Pay object reference.
Use the details below to set up your request.
Read our payment sources API reference for a list of all endpoints, as well as complete request and response examples.
{
"type": "googlepay",
"source": {
"signature": "MEYCIQCFH1ytUSUFjzcO2vMiBK0nvIFdxVA1LJ6qQLvZfNlOYgIhAMjwlReXBsN5Kymx0bfXwyEiq2rP6kysuUjxls33eI41",
"intermediateSigningKey": {
"signedKey": "{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEk85UmyIpVkJRPtEOu3CR9gaYuvzk1dddBhe3xYFQMUewQu3nkKlwaRHjJyhyM/VoncDasqyJbQT9tdkqNcyR7Q\\u003d\\u003d\",\"keyExpiration\":\"1629439717593\"}",
"signatures": [
"MEQCIGf/iD9SRDPW18xSxLTIPey2vIoH8Td9miuDD7Z3OyvTAiAtPZkaa9Rr4LvxxjbEc0UjvgrwChyou5+aB+WLOwTU6w=="
]
},
"protocolVersion": "ECv2",
"signedMessage": "{\"encryptedMessage\":\"wTURe+UL6laT/2R+n7tjB1JwiN8uHYbiKK2Q+aNV2WFYuxXtWMx5ITHCjDBch423Kjvuox1zNfJ07180c1QjR1QIlJCQi+it0yzagtXRyvZepiA4y1EI2szbr9fDVTxBFEHJ7P/Eh+A5Myj5fhGYZz5L4Ibj1wsFSu5FUkfCuAUSarvnalxIyWpHSmcJo5mwb6K02ZR8kfg0DN8R7kr3ckFl2mLsSQmknc4SJVEd7lCBPMkoSQ7vCVAoU0D59rDvvgnV97Ab+2aF3vqxGWfop7H5RwI7PqoCpFQKphmgBAt9OQCsIOULvmwzwyGCkggtlELJn9z9k1rtRLK8DAfOENpj4McwJrhGfJVPgv606tUhyO+FtCjezhJKPjp2QbO3XfS9VuFDS9ZpNkToF0So3TkRt6V8NzzO1IPfOSB++QnHQAPdQo9AhHEWRq99Za3SAtK7uFeLBJJ4GOXFSKH159UTdEvL5qWZ8CYcgKwzQzi4jNoB+dmwwz8RDZnePCYAE0/1mfnfqshA+NFA7NsQEuN+n1Vny9vAeypU2uUs2DuLW7IP1lSB2fQMXvqora7AG0eXvusR0fa88Pe5MGop4Wi1HtVYUYRG7cKbXsq8KGlcpYpW59mru+zMf4r6owflcJ7PiuPYH6NblJ6N7TXYSO2Eh7s\\u003d\",\"ephemeralPublicKey\":\"BM5Faah9qm/4l/ND5If+g/A5v/u3mYSeKsSFQVrmucptDaj8z2epUpsddzP3iqYaL2n4gnYXQ3SH5usfkUCNMHE\\u003d\",\"tag\":\"OlmHGjmOZPyB/AnD/SXWChzuv5fWXB35Wm93xPiQYNg\\u003d\"}"
}
}
{
"response": {
"token": "ps_UKOm94HHNcYliozFVfpdTw",
"type": "googlepay",
"source": {
"token": "card_BJC5kA-rP9QesNJu8P6_kw",
"scheme": "master",
"display_number": "XXXX-XXXX-XXXX-0000",
"issuing_country": "US",
"expiry_month": 5,
"expiry_year": 2022,
"name": null,
"address_line1": null,
"address_line2": null,
"address_city": null,
"address_postcode": null,
"address_state": null,
"address_country": null,
"customer_token": null,
"primary": null,
"network_type": "googlepay",
"network_format": "cryptogram_3ds"
}
},
"ip_address": "192.0.2.42"
}
Now you have the payment source token, you can create the charge. Take the payment source token, and use it in the body of a charge request from your application.
Google Pay does not allow the configuration of test cards within its online wallet. However, when using Google’s test environment, if a real card is selected when making the online purchase, Google Pay provides a test card in the encrypted payment data; ensuring that no actual transaction occurs.