Developer Portal

12 Code Details

Queue Transaction

See the PaywayWS Integration Guide for details and samples of the queueSale and queueAuthorize transactions.

 

GooglePay.js JavaScript

To integrate with Payway’s Google Pay offering, start with the sample JavaScript called GooglePay.js. This contains all features you need to integrate the web client with Google Pay.

 

Card Networks and Authorization Methods

The configuration in GooglePay.js has the supported card networks and authorization methods. Change the supported card networks if you would like to remove one or more of the entries.

const allowedCardNetworks = ["AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA"];
const allowedCardAuthMethods = ["PAN_ONLY", "CRYPTOGRAM_3DS"];  

Required Billing Data

This section sets up the required billing data for presentation of the Google Pay payment sheet. Do not require less than ‘MIN’ billing address parameters. For card not present transactions the zip code must be presented to avoid extremely high charges to the merchant.

billingAddressRequired:true,
billingAddressParameters:
// MUST BE AT LEAST ‘MIN’ but ‘FULL’ recommended
{
format : ‘MIN’,    // ‘FULL’ for complete address info
phoneNumberRequired : true
}

 

Additional Cardholder Data

Some account data accepted by Payway will not appear on the Google Pay billing sheet. For example, email address can be added to your payment page and sent in along with the Google Pay encrypted data.

 

Adding the Google Pay Button

On your payment page simply add this html:

<div id=”googleButton”></div>

 

Loading Google Pay

The Payway JavaScript and the Google Pay JavaScript must be loaded on your payment page:

<script src=”js/GooglePay.js” type=”text/javascript”></script>
<script src=”https://pay.google.com/gp/p/js/pay.js” ></script>

When the page loads call onGooglePayLoaded:
<body onload=”onGooglePayLoaded()”>

 

OnGooglePayLoaded()

This method creates a payments client, checks if Google Pay is ready, and sets up the payment gateway parameters.

In the tokenizationSpecification, use ‘exampleGatewayMerchantId’ until you go into production with your merchant id.

tokenizationSpecification = {
type: ‘PAYMENT_GATEWAY’,
parameters: {
‘gateway’: ‘payway’,
‘gatewayMerchantId’: ‘exampleGatewayMerchantId’
}

 

onGooglePaymentButtonClicked()

The payment data request is set up, and the payment is processed. Note that in processPayment, the PaywayWS request is created and sent to Payway.

The googlePayToken field is set to the encrypted Google Pay paymentData, and the paywayRequestToken is taken from the page. Other PaywayWS fields can be sent in this request, such as email.

 

PaywayWS JSON request:
{
accountInputMode : “googlePayToken”,
paywayRequestToken :
document.getElementById(‘paywayRequestToken’).value,
request : “sendQueuedTransaction”,
googlePayToken : paymentData ,

cardAccount :
{
accountNotes1: “notes1”,
accountNotes2: “notes2”,
accountNotes3: “notes3”
}

}

12.1 Queue Transaction

See the PaywayWS Integration Guide for details and samples of the queueSale and queueAuthorize transactions.

12.2 GooglePay.js JavaScript

To integrate with Payway’s Google Pay offering, start with the sample JavaScript called GooglePay.js. This contains all features you need to integrate the web client with Google Pay.

12.3 Card Networks and Authorization Methods

The configuration in GooglePay.js has the supported card networks and authorization methods. Change the supported card networks if you would like to remove one or more of the entries.

const allowedCardNetworks = [“AMEX”, “DISCOVER”, “JCB”, “MASTERCARD”, “VISA”];
const allowedCardAuthMethods = [“PAN_ONLY”, “CRYPTOGRAM_3DS”];

12.4 Required Billing Data

This section sets up the required billing data for presentation of the Google Pay payment sheet. Do not require less than ‘MIN’ billing address parameters. For card not present transactions the zip code must be presented to avoid extremely high charges to the merchant.

billingAddressRequired: true,
billingAddressParameters: 
 // MUST BE AT LEAST ‘MIN’ but ‘FULL’ recommended
 {
     	format : 'MIN',    // ‘FULL' for complete address info
              phoneNumberRequired : true
    }

 

12.5 Additional Cardholder Data

Some account data accepted by Payway will not appear on the Google Pay billing sheet. For example, email address can be added to your payment page and sent in along with the Google Pay encrypted data.

12.6 Adding the Google Pay Button

On your payment page simply add this html:

12.7 Loading Google Pay

The Payway JavaScript and the Google Pay JavaScript must be loaded on your payment page:

<script src="js/GooglePay.js" type="text/javascript"></script> 
<script src="https://pay.google.com/gp/p/js/pay.js" ></script>

When the page loads call onGooglePayLoaded:
<body onload="onGooglePayLoaded()">

 

12.8 OnGooglePayLoaded()

This method creates a payments client, checks if Google Pay is ready, and sets up the payment gateway parameters.

In the tokenizationSpecification, use ‘exampleGatewayMerchantId’ until you go into production with your merchant id.

tokenizationSpecification = {
  type: 'PAYMENT_GATEWAY',
  parameters: {
    'gateway': 'payway',
    'gatewayMerchantId': 'exampleGatewayMerchantId'
  }

 

12.9 onGooglePaymentButtonClicked()

The payment data request is set up, and the payment is processed. Note that in processPayment, the PaywayWS request is created and sent to Payway.

The googlePayToken field is set to the encrypted Google Pay paymentData, and the paywayRequestToken is taken from the page. Other PaywayWS fields can be sent in this request, such as email.

PaywayWS JSON request: 
{ 
            accountInputMode : "googlePayToken",
            paywayRequestToken :  document.getElementById('paywayRequestToken').value,
            request : "sendQueuedTransaction",
            googlePayToken : paymentData ,
         
            cardAccount :
            {
                accountNotes1: "notes1",
                accountNotes2: "notes2",
                accountNotes3: "notes3"
            }
                            
   }

 

12.10 Test and Production Modes

For testing, the Javascript in Section XII defaults to test mode.  The directive:

paymentsClient = new google.payments.api.PaymentsClient({environment: ‘TEST’} is set to TEST mode which indicates to GOOGLE that you are in test mode allowing for the development and testing of your application.

Once the application has been  approved by GOOGLE and a merchantId, merchantName  has been assigned, update new paymentsClient = new google.payments.api.PaymentsClient({environment: ‘PRODUCTION’}. This will indicate this is a production environment to Google.

Subscribe

Every post in your inbox