Google Pay Module
See the Google PayTM Feature Page for more information and options on how to integrate Google Pay with BR-DGE.
The Google Pay module enables payments using the Google PayTM for Payments - Web API. This works by integrating with Google Pay to generate a single-use Google Pay Nonce, which is used as a payment instrument via the BR-DGE REST API.
Implementation
BR-DGE integrates with Google Pay with Payment Service Providers (PSPs).
This means BR-DGE registers with Google Pay and acts as a reseller so we can do transactions on your behalf.
To use this functionality, you will need to:
- Add the Google Pay Module to Your App.
- Receive the Google Pay Nonce.
- Send the Google Pay Nonce to the BR-DGE REST API.
- Please ensure you support the 3-D Secure Payment Flow as Google Pay transactions with authMethod
PAN_ONLY
must comply with SCA and network regulations. BR-DGE will submit thePAN_ONLY
credentials and 3-D Secure information for improved chances of a successful payment.
We do not restrict payments to and from other countries, please refer to your PSPs documentation for their accepted authorization methods and supported card networks.
All merchants must adhere to the Google Pay APIs Acceptable Use Policy and accept the terms defined in the Google Pay API Terms of Service. For more information, see Google Pays Brand Guidelines.
Add the Google Pay Module to Your App
After you have set up the Comcarde JavaScript Client, you can add the google-pay
module to your website source.
<script src="https://sandbox-assets.comcarde.com/web/v2/js/google-pay.min.js"></script>
<script src="https://assets.comcarde.com/web/v2/js/google-pay.min.js"></script>
Next insert a placeholder element to your page and give it a unique id so the google-pay
module can populate it with a Google Pay button, for example:
<div id="google-pay-button"></div>
Finally, add Google Pay functionality to your Comcarde JavaScript Client:
comcarde.client.create(
{
authorization: client - api - key, // your client API Key
},
function (clientErr, clientInstance) {
// optionally configure other plugin modules...
// Declare empty mutable object for the comcardeGooglePayInstance
let comcardeGooglePay = {}
comcarde.googlePay
.create(
{
client: clientInstance,
containerId: 'google-pay-button', // <- unique identifer of your button element
},
function () {
comcardeGooglePay
.startPaymentJourney({
/*
* This object describes a transaction that determines a payer's ability
* to pay. It's used to present a payment authorization dialog.
* Please see https://developers.google.com/pay/api/web/reference/request-objects#TransactionInfo
* for a full description
*/
totalPriceStatus: 'FINAL',
totalPrice: '9.99',
countryCode: 'GB',
currencyCode: 'GBP',
})
.then(function (payload) {
/*
* send payload.token to your server to be used as a Google Pay payment
* instrument in a payment request.
*/
console.log('googlePay token: ' + payload.token)
/*
* payload.id contains a unique identifier for the response. This will
* be helpful to us if you need assistance or support
*/
console.log('googlePay tokenization trace id: ' + payload.id)
})
.catch(function (startPaymentJourneyError) {
console.error(startPaymentJourneyError)
})
}
)
.then(function (comcardeGooglePayInstance) {
/*
* Assign the Comcarde Google Pay instance to the comcardeGooglePay variable
* for use in the payment callback
*/
comcardeGooglePay = comcardeGooglePayInstance
})
.catch(function (googlePayModuleError) {
console.error(googlePayModuleError)
})
}
)
Testing Google Pay
See the Testing Google Pay page for more information on:
- Testing against a PSP sandbox.
- Testing against a mock sandbox.
Updated 3 months ago