My Profile_


On the Web

Building a Google Pay™ Web Demo Checkout Page

A demo website checkout page is required as part of the integration process for Google Pay™ Web. Google provides code for a Google Pay™-enabled demo checkout page to make it easy.
To build a Google Pay™ Web demo checkout page:

  1. Go to Google's developer tutorial page for Google Pay™ Web at https://developers.google.com/pay/api/web/guides/paymentrequest/tutorial
  2. Copy the code shown under the subheading "Putting it all together" and paste it into your code editor
  3. After the initial div, add the following script tag:
    <script async src="https:/ <script async
    src="https://esqa.moneris.com/googlepay/googlepay-api.js"
    onload="MonerisGooglePay.onReady()"></script>
  4. Below that script, add a div with the id "moneris-google-pay", substituting your test values for Store ID and Web Merchant Key in place of the store-id and web-merchant-key as shown below:
    <div id="moneris-google-pay" store-id=”MONERIS-GATEWAY-STORE-ID" webmerchant-
    key=”WEB-MERCHANT-KEY"></div>
  5. In function onBuyClicked, under createPaymentRequest(), insert these lines:
    paymentData["orderId"] = "Unique Order Id”;
    paymentData["amount"] = “Same as GoogleTransactionInfo()[‘TotalPrice’]”

Integrating Your Demo Checkout Page With Moneris Gateway

To begin testing your integration, you need to modify code in your Google Pay™ Web demo checkout page project to enable it to communicate with the Moneris Gateway.
To integrate your demo checkout page with the Moneris Gateway, do the following:

  1. In the code for your demo checkout page, in the object tokenizationSpecification:
    a. Set the parameter gateway to the value to 'moneris'
    b. Set gatewayMerchantId to your test store ID value
  2. After the initial div, add the following script tag:
    <script async src="https:/ <script async
    src="https://esqa.moneris.com/googlepay/googlepay-api.js"
    onload="MonerisGooglePay.onReady()"></script>
    
  3. Below that script, add a div with the id "moneris-google-pay", substituting your test values for Store ID and Web Merchant Key in place of the values for store-id and web-merchant-key as shown below:
    <div id="moneris-google-pay" store-id=”MONERIS-GATEWAY-STORE-ID" webmerchant- key=”WEB-MERCHANT-KEY"></div>
  4. In function onBuyClicked, under createPaymentRequest(), insert these lines:
    paymentData["orderId"] = "Unique Order Id”;
    paymentData["amount"] = “Same as GoogleTransactionInfo()[‘TotalPrice’]”
  5. In the same function onBuyClicked, underneath the line .then(function(response) {, add the code below to call the transaction builder, as shown for a Purchase transaction:
    MonerisGooglePay.purchase(paymentData, function(response) {
    if ( response && response.receipt && response.receipt.ResponseCode
    && !isNaN(response.receipt.ResponseCode) )
    {
    if ( parseInt(response.receipt.ResponseCode) < 50 ) {
    alert("Looks like the transaction is approved.");
    }
    else {
    alert("Looks like the transaction is declined.");
    }
    }
    else {
    throw ("Error processing receipt.");
    }
    });
    

Getting the Web Merchant Key for Google Pay™ Web

You can find your Google Pay™ Web Merchant Key in the Moneris Merchant Resource Center under Admin > Google Pay at:
Testing: https://esqa.moneris.com/mpg
Production: https://www3.moneris.com/mpg
Use the Web Merchant Key that corresponds to whichever stage of development you are in (testing vs. production).

Google Pay™ Transaction Types

The Moneris Gateway can process the following transaction types via integration with the Google Pay™ In-App and Google Pay™ Web SDK:

  • Google Pay™ Purchase
  • Google Pay™ Pre-Authorization
  • Recurring Billing transactions
  • Transactions are carried out by automated builders according to Google's current development standards for applications.
  • The transaction request builder will build out Google Pay™ Purchase and Google Pay™ Pre-Authorization transactions
  • The Recur builder creates the Recur object, which contains the details of a recurring transaction
  • The Moneris httpspost builder performs the necessary communications between the Moneris Gateway and Google Pay™.

Transaction Request Builder

Transaction requests in Google Pay™ are built by Google's transaction request builder. Below are the request variables which get built into the transaction request.

Transaction Request Variables – Required Fields
Variable Set Method Description
Transaction Type .setTransactionType(Constants.TransactionCode.PURCHASE) The type of transaction being sent
Possible values:
PURCHASE
PREAUTH
Order ID .setOrderId("GooglePayTest-"+new Date().getTime() Merchant-defined transaction identifier that must be unique for every Google Pay Purchase and Google Pay Pre-Authorization transaction

No two transactions of these types may have the same order ID
Payment Data .setPaymentData(data) Object representing the payment data response from Google, which contains the necessary payment result to complete the payment

For more on this, see Google's APIs for Android documentation
Amount .setAmount (PaymentsUtil.microsToString (mBikeItem.getPriceMicros ()+mShippingCost)) Transaction amount

Getting a Unique Test Store ID and API Token

Transactions requests via the Moneris Gateway API will require you to have a Store ID and a corresponding API token.
For testing purposes, you can either use the pre-existing test stores with the corresponding test API tokens, or you can create your own unique test API token and a unique test store where you will only see your own transactions.

    To get your unique Store ID and API token for testing:
  1. Log in to the Developer Portal at https://developer.moneris.com
  2. In the My Profile dialog, click the Full Profile button
  3. Under My Testing Credentials, select Request Testing Credentials
  4. Enter your Developer Portal password and select your country
  5. Record the Store ID and API token that are given, as you will need them for logging in to the Merchant Resource Center (Store ID) and for API requests (API token).

Requesting Production Access from Google

Once you have completed testing your Google Pay™ integration, you must request production access from Google. Google will evaluate your integration against their integration checklist. Both the integration checklist and the production access request are found on Google's developer site at:
In-App
https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist
Web
https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist

Definition of Response Fields
Variable Size/Type Description
ReceiptId 50-character alphanumeric The order id specified in the request will be echoed back in the response. This field is recommended to be displayed on the receipt for tracking and troubleshooting purposes.
Order ID setOrderId("GooglePayTest-"+new Date().getTime() Merchant-defined transaction identifier that must be unique for every Google Pay™ Purchase and Google Pay™ Pre-Authorization transaction
No two transactions of these types may have the same order ID
ReferenceNum 18-character numeric This is a bank transaction reference number. The entire reference number must be displayed on the receipt. This information should also be stored by the merchant. The following illustrates the breakdown of this field where "660123450010690030” is the reference number returned in the message.
  • 660123450010690030
  • 66012345: Terminal ID
  • 001: Shift number
  • 069: Batch number
  • 003: Transaction number within the batch.
ReponseCode 3-character numeric Transaction Response Code < 50:
Transaction approved >= 50:
Transaction declined NULL: Transaction was not sent for authorization

Custom Google Pay™ Response Code 900 : Global Error means that Moneris Gateway was unable to decrypt payload.
ISO 2-character numeric ISO response code
AuthCode 8-character alphanumeric Authorization code returned from the issuing institution
TransTime HH:II:SS Processing host time stamp. Time of the transaction. Must be displayed on the transaction receipt.

HH = 2-digit hour, 24 hour clock (“0” left padded | 02 = 2am, 14 = 2pm)

II = 2-digit minute (“0” left padded)

SS = 2-digit seconds (“0” left padded
TransDate YYYY-MM-DD Processing host date stamp. Date of the transaction. Must be displayed on the transaction receipt.

YYYY = 4-digit year

MM = 2-digit month (“0” left padded | Jan = 01)

DD = 2 digit day of month (“0” left padded)
TransType alphanumeric Type of transaction that was performed

00 = Purchase

01 = Pre-authorization
Complete true/false Transaction was sent to authorization host and a response was received
Message 100-character alphanumeric Response description returned from issuing institution
TransAmount nnnnnnN.NN 9-character decimal (variable length) Returns the amount sent in request for processing. The amount represents the amount that the cardholder was charged/refunded. The amount must be displayed on the receipt.

NOTE: The amount will always contain one (1) dollar value and two (2) cent values separated by a period “.”.

N = always returned

n = returned when required
TransID 20-character alphanumeric Gateway Transaction identifier
CardType 2-character alphanumeric Credit Card Type

M = MasterCard

V = Visa

AX = American Express

P = INTERAC®
TimedOut true/false Transaction failed due to a process timing out
Bank Totals Object Response data returned in a Batch Close and Open Totals request.
Ticket n/a Reserved field
CorporateCard true/false Indicates whether the card is a corporate card or not
CAVV 40-character alphanumeric Decrypted CAVV value for the transaction

Returned for Google Pay™ Purchase/Pre-Authorization transaction if payload is successfully decrypted
IsVisaDebit true/false/null Indicates whether the card that the transaction was performed on is Visa debit

true = Card is Visa Debit

false = Card is not Visa Debit

null = there was an error in identifying the card
RecurSuccess true/false Indicates whether the transaction successfully registered