Third Party Google Pay
Google Pay is a digital wallet platform and online payment system that powers in-app, tap-to-pay, and website purchases. It enables users to make payments online from the Web and with Android phones, tablets and watches. Because Google Pay represents a significantly different workflow than that used with traditional payment methods, it’s important to first understand how it works before integrating with Spreedly.
Third Party Google Pay preparation
- Review Google’s list of participating processors.
- Check Spreedly’s supported gateways.
- Review Google’s approval process for Android devices or Google Pay on the Web.
- Complete the integration checklist (Android | Web) before requesting production credentials from Google.
- Review Spreedly's testing guidelines
How Third Party Google Pay works with Spreedly
When a customer adds a credit or debit card to their Google Pay app, Google Pay requests a token, from the bank that issued that card, to represent the card being added. Once the token is issued, this card is now “tokenized,” meaning it has a unique identification number associated with it. Google Pay encrypts the newly tokenized card and it is ready to be used for payments. At the time of sale, Google Pay sends the customer’s tokenized card and a cryptogram, which acts as a one-time-use password used in the encryption process, to the merchant app along with basic transaction information. The next step is to decrypt the payload from Google and send the payment token and related transaction information to a supporting processor. The token is sent to one of the few gateways that natively support Google Pay.
The overall transaction flow is very similar to the traditional Google Pay process. The only difference is that Spreedly receives the encrypted Google Pay payload from the merchant app and is responsible for sending that encrypted Google Pay payload to a chosen gateway.
For the authentication method of the card transaction, authMethod in paymentMethodDetails, gateways usually supports both PAN_ONLY and CRYPTOGRAM_3DS. PAN_ONLY gives support for payment methods that Google Pay deems are non-tokenized cards. CRYPTOGRAM_3DS gives support for payment methods that Google Pay deems are tokenized cards. Additional information regarding the google pay type is included in the Transactions section below.
When requesting the encrypted payload from Google, the merchant app needs to include the following values for the gateway and gatewayMerchantId fields:
{
"type": "CARD",
"parameters": {
"allowedAuthMethods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"allowedCardNetworks": [
"AMEX",
"DISCOVER",
"JCB",
"MASTERCARD",
"VISA"
]
},
"tokenizationSpecification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "gateway", // this is specified by the gateway
"gatewayMerchantId": 'gateway_merchant_id' // this is specified by the gateway
}
}
}
<allowedPaymentMethods>
<type>CARD</type>
<parameters>
<allowedAuthMethods>
<allowedAuthMethod>PAN_ONLY</allowedAuthMethod>
<allowedAuthMethod>CRYPTOGRAM_3DS</allowedAuthMethod>
</allowedAuthMethods>
<allowedCardNetworks>
<allowedCardNetwork>AMEX</allowedCardNetwork>
<allowedCardNetwork>DISCOVER</allowedCardNetwork>
<allowedCardNetwork>JCB</allowedCardNetwork>
<allowedCardNetwork>MASTERCARD</allowedCardNetwork>
<allowedCardNetwork>VISA</allowedCardNetwork>
</allowedCardNetworks>
</parameters>
<tokenizationSpecification>
<type>PAYMENT_GATEWAY</type>
<parameters>
<gateway>spreedly</gateway>
<gatewayMerchantId>SPREEDLY_ENVIRONMENT_KEY</gatewayMerchantId>
</parameters>
</tokenizationSpecification>
</allowedPaymentMethods>
Implementing ThirdPartyGooglePay is completely specific to the gateway therefore the first step is to check their documentation to validate the exact credentials and steps needed to create a Google Pay Payment Token.
Supported gateways
Currently, you can use ThirdPartyGooglePay on the following gateways:
Spreedly Gateway Guide | Gateway GooglePay Integration Docs |
---|---|
Elavon | Elavon GooglePay Docs |
Worldline (formerly Global Collect) | Worldine GooglePay Docs |
Making a purchase
When a ThirdPartyGooglePay transaction is initiated, a Payment Token (paymentMethodData.tokenizationData.token) containing a JSON-formatted string is sent to the merchant app. This paymentMethodData.tokenizationData.token is what Spreedly needs to process the transaction and looks something like this
{
"signature": "MEYCIQDTe92wpG6OUgxJ/8Qnr36XzSgjGGCM7R3LwxjgwPYMTAIhAJDrjHG9wEm1BxVM6MMMB+jGTGpi3VScEMVbHIUsObFi",
"protocolVersion": "ECv1",
"signedMessage": "{\"encryptedMessage\":\"FY8w/U3IbdsZQovX8ufNGFDOePgc/genRiMjHyvuIBqLY4a6uPz7wI0ra31K6YbFJlAnCjFhTwSvDxAYXw6hlmI8sESO5eM1eZlzfP3+NoKV80OXKvOM/xI/qOQEqpEQEVXx6Bw2EpMMFW8yBaA8XPUNee3EJlUk+/f8lRdRcNmI65QKPLAzUnySo75HzBkSc5It/8/oXdYwR93/K6HRKGZuD+bIaxy3SUvC9ehQqhBoP+A34yQX1knfJ1qjBMhhVVcPZHi+Bg6LXA4ms/lfDdim6D1Epr6XQhc2h4RZ/dT+6Enn81s/8ym+jMMs8kqsW9ib8vkdTARv9AbUu7zeGPrKTCAxwc1n6joRR72dSnNCI9j9sxd9tkuC9wuRyDmjbWT+hRZgLc1v/xzzNImo3NxdKdaPzKBE3t9XQZY5fp3lZELaoXAuxAZYtZ7bX64Mz9c28wD8EM+krvfbmGMiBjIt8EfeH48/SjeaUKfDu+yQnjPJAKbDZPhKJ1jqlY/ChP0Om7spQacT86QUVK/DwfzukwvwwRJkWydNEac5fgfS2T6ToZ+PW4VHbxkDnY/h+B0uwdlNQIL2a3Ar5Q\\u003d\\u003d\",\"ephemeralPublicKey\":\"BGkK4bSvob+e7ZgaNV/4vSJYYa10OJzd3aUk9yPEP6iNBRcfHiD/NTvhKjN4P24l0tEzH3L8TrySl6AczPJpCkw\\u003d\",\"tag\":\"xGEhEfJESIyBSfq2fExWiZxNWelnm3m4i8P7cgsarqg\\u003d\"}"
}
Transacting with a ThirdPartyGooglePay payment method is very similar to using a credit card. Depending on your gateway’s support, you can initiate an authorize or purchase, passing in the Google Pay paymentMethodData.tokenizationData.token string. You can also add a ThirdPartyGooglePay payment method as a separate call from the actual transaction, and pass the payment_method_token to the transaction instead.
Purchase example:
curl https://core.spreedly.com/v1/gateways/LlkjmEk0xNkcWrNixXa1fvNoTP4/purchase.xml \ -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \ -H 'Content-Type: application/xml' \ -d '<transaction> <amount>1122</amount> <currency_code>USD</currency_code> <third_party_google_pay> <payment_data><![CDATA[{"signature":"MEUCIA6SGVRwhOyeYRkeDUUNwB/kGtyfQAlOsg7NZydT17u/AiEA48BhWGQEF1EbEU0J+m8eSK3rTfhok9QqpiFVbME+Ky0\u003d","protocolVersion":"ECv1","signedMessage":"{\"encryptedMessage\":\"3v4IcT/eovIDP2WF8iRUy4qWQnE9Cx0vQxIZ5f9i3Emv3Tzs1AzvB7cxXhxrjp9FVIzdOwsZAPAsm03gvoYq8Xdr70XvrVRd2MFwQhMC7IV/uEsthw4JsR8oCkbI5v/zqhu2B+JodFgavNliHcpKBgijy2D6bpx7jXEkM39M/L4oBObFxFrhVSLA1GjOV6A5gLAXNXt0ffkCYekihqAyJrWlk3sCBDCF5SUiAKEIOIZtzZLgusxjVp6ufZHOHm/53uhAi6JWSJ1E6G5aaYGtULYdwgURHtxN5OIzQPYlEGctaQd5tgfCsBFfGkYyN1GRNgclbaLzAfk/Jn7/6IVKuV0ol3xubTcnjGTZXwtTjiEyYDoz1yVqB9ViMmJa55L6nBtbbAkcNEgAi7dPnrbvBGEP7QWsNT9D71g8SWrlRTCYUAOyuamaQhofG4ul1IVjmltdAy2BHBWpqgJnR9kczydQyE7uDiqhSC1/0eG8GCGIqoi8XfOioGXfMyLZ1p2ZcNK9ECjzUrH/edrwgtShxgWuWMwQTM4DQlVTAA/R4DVs192YWZcc7jm5wLqZ0+XEaPuighJM1Ps1Egeccg\\u003d\\u003d\",\"ephemeralPublicKey\":\"BA2SvF9BdCX7Tl1wwRkyLzTfqhctobhZgSugC9Cz77XNUCBOBMfFyJQt506PUs89D6IJZZfOkZopy0shRF9Uph4\\u003d\",\"tag\":\"Uhin1BE7KAuuiam7eEQFimRUDd9Xn6tZc2fClTpfrXQ\\u003d\"}"} ]]></payment_data> <gateway_type>'elavon'</gateway_typer> </third_party_google_pay> </transaction>'
Please note that ThirdPartyGooglePay transactions should include gateway_type as a parameter. Since these payment methods are gateway_specific, ThirdPartyGooglePay payment methods are locked to the gateway type that was specified, and you'll receive an error if you try to use them with the wrong gateway.
<transaction> <on_test_gateway type="boolean">true</on_test_gateway> <created_at type="dateTime">2018-09-27T11:03:41Z</created_at> <updated_at type="dateTime">2018-09-27T11:03:41Z</updated_at> <succeeded type="boolean">true</succeeded> <state>succeeded</state> <token>IKkSx9f72fVQ10H3AzcHFDADvIt</token> <transaction_type>Purchase</transaction_type> <order_id>AH2EjteGTgCbm_KqL7GsQKBb41AD1wjKBt5e5LfRv8XW6Hs-c1swAd5fXRYyJz8Apl4ypCkOEuLf9YNe0my25BwuwIFo6OSa2pLSD4aXT8TQywlTnCKPBShMId5iF2sT-DbsSNO66dcu</order_id> <ip nil="true"/> <description nil="true"/> <email nil="true"/> <merchant_name_descriptor nil="true"/> <merchant_location_descriptor nil="true"/> <gateway_specific_fields nil="true"/> <gateway_specific_response_fields> </gateway_specific_response_fields> <gateway_transaction_id>55</gateway_transaction_id> <gateway_latency_ms type="integer">0</gateway_latency_ms> <amount type="integer">1122</amount> <currency_code>USD</currency_code> <retain_on_success type="boolean">false</retain_on_success> <payment_method_added type="boolean">true</payment_method_added> <message key="messages.transaction_succeeded">Succeeded!</message> <gateway_token>IRMVoS9jurugLBkX8pM7YTmTj9F</gateway_token> <gateway_type>test</gateway_type> <shipping_address> <name></name> <address1 nil="true"/> <address2 nil="true"/> <city nil="true"/> <state nil="true"/> <zip nil="true"/> <country nil="true"/> <phone_number nil="true"/> </shipping_address> <response> <success type="boolean">true</success> <message>Successful purchase</message> <avs_code nil="true"/> <avs_message nil="true"/> <cvv_code nil="true"/> <cvv_message nil="true"/> <pending type="boolean">false</pending> <result_unknown type="boolean">false</result_unknown> <error_code nil="true"/> <error_detail nil="true"/> <cancelled type="boolean">false</cancelled> <fraud_review nil="true"/> <created_at type="dateTime">2018-09-27T11:03:41Z</created_at> <updated_at type="dateTime">2018-09-27T11:03:41Z</updated_at> </response> <api_urls> </api_urls> <payment_method> <token>IbI86ToYVmcFngoM9kYWlsG64Lm</token> <created_at type="dateTime">2018-09-27T11:03:41Z</created_at> <updated_at type="dateTime">2018-09-27T11:03:41Z</updated_at> <email nil="true"/> <data nil="true"/> <storage_state>cached</storage_state> <test type="boolean">true</test> <first_name nil="true"/> <last_name nil="true"/> <month type="integer">12</month> <year type="integer">2023</year> <full_name></full_name> <address1 nil="true"/> <address2 nil="true"/> <city nil="true"/> <state nil="true"/> <zip nil="true"/> <country nil="true"/> <phone_number nil="true"/> <company nil="true"/> <shipping_address1 nil="true"/> <shipping_address2 nil="true"/> <shipping_city nil="true"/> <shipping_state nil="true"/> <shipping_zip nil="true"/> <shipping_country nil="true"/> <shipping_phone_number nil="true"/> <payment_method_type>third_party_google_pay</payment_method_type> <errors> </errors> </payment_method> </transaction>
Updated 3 months ago