Request a Google Pay token when the Google Pay button is clicked. Once the token is received from Google, pass it to the EdgePay getToken method to get a Pivot token back that you can send to your backend to submit the payment.

var processGooglePayPayment = function () {
                   
  var paymentDataRequest = isReadyToPayRequest;
 
  //Example on how to modify the paymentDataRequest object                
  
  //Define the transaction information
  paymentDataRequest.transactionInfo = {                    
    "totalPriceStatus": "FINAL",                    
    "totalPrice": 1.00,                    
    "currencyCode": "USD"                
  };
  
 //Provide a user-visible merchant name and your Google Merchant ID
  paymentDataRequest.merchantInfo = {
  merchantName: 'Example Merchant',
  merchantId: '12345678901234567890'
};
 
  //We require all Google Pay transactions to include the billing postal code
  //Below you can see an example of how to modify the paymentDataRequest object
  //to request the billing information  
  var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods[0];
  cardPaymentMethod.parameters.billingAddressRequired = true;
  cardPaymentMethod.parameters.billingAddressParameters = {
    format: 'MIN'
  };
 
                
paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {                    
    //After receiving the Google Pay payment data, pass it to the getToken
    //method to receive an EdgePay Pivot token               
    EdgePay.googlePay.getToken({                        
      paymentData,                        
      onSuccess: function (response) {                            
        console.log("success ", response);
                //Submit the token (response.successResponse.tokenID) 
        //and payment information (amount, zip code, etc) to your backend for processing.                        
      },                        
      onError: function (response) {                            
        console.log("error", response);                        
      }                    
    })                
  }).catch(function (err) {                 
    console.error(err);                
  });            
}