On this page:
Overview
A new JSON Web Token (JWT) solution allows Nuvei to onboard merchants to Google once, renew their JWT public key annually, and dynamically enable an unlimited number of web domains without having to register each one in the Google Pay and Wallet consoles.
Implementation Steps
-
- The merchant registers their domains with Nuvei using the
/registerGooglePayDomains
API call.
The merchant registers each domain only once (not per transaction). - Web SDK only – Merchants using Google Pay Web SDK integration need to call the
createGooglePayPayment()
method. - For each transaction, the merchant needs to provide Google the
merchantOrigin
(the domain from which the Google Pay call was initiated) and a JWT (authJwt
), which indicates that the domain was registered by Nuvei). - The merchant receives a registered domain and JWT for each transaction by calling the
/googlePayMerchantInfoJwt
method. - The merchant adds the
merchantInfo
object (that includes the domain name and the JWT) to the Google PayPaymentDataRequest
object.
- The merchant registers their domains with Nuvei using the
Calling the createGooglePayPayment()
method
//Function merchant must create and send to onClick event in addGooglePayButton function function googlePayment() { //Payload to be sent in webSDK createPayment method let nuveiPaymentPayload = { sessionToken: sessionData.sessionToken, billingAddress: { email: '[email protected]' } }; const googlePaymentsClient = getGooglePaymentsClient(); const googlePaymentDataRequest = getGooglePaymentDataRequest(); googlePaymentDataRequest.transactionInfo = getGoogleTransactionInfo(); /** * createGooglePayPayment function from the webSDK * @constructor * @param {Object} paymentPayload - Payload for webSDK createPayment method * @param {Object} googlePaymentDataRequest - Payload for Google Pay API JavaScript library * @param {Promise} googlePaymentsClient - Instance of the Google Payments client that was created in getGooglePaymentsClient method */ window.sfc.createGooglePayPayment(nuveiPaymentPayload, googlePaymentDataRequest, googlePaymentsClient, finalCallback) }
Google Pay PaymentDataRequest
Object
PaymentDataRequest = { apiVersion: 2, apiVersionMinor: 0, merchantInfo { merchantId: '01234567890123456789', merchantOrigin: 'sub-merchant.com', // Required for JWT merchantName: 'Merchant ABC', authJwt: 'aaaaa.bbbbb.ccccc' // Required for JWT } allowedPaymentMethods: [ { type: 'CARD', parameters: { allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'] allowedCardNetworks: ['AMEX', 'VISA', 'MASTERCARD'], billingAddressRequired: true, } tokenizationSpecification: { type: 'PAYMENT_GATEWAY', parameters: { gateway: 'example', gatewayMerchantId: 'merchantGatewayMerchantId' } } }, ], }
Additional Methods
- Merchants can use the
/unregisterGooglePayDomains
method to unregister domains. - Merchants can use the
/getRegisteredGooglePayDomains
method to retrieve a list of their registered domains.