My Profile_

In App


This documentation contains the instructions for integrating Google Pay™ as an in-app purchase option using the Moneris Gateway Google API for Canada. It contains specifications for transaction requests and responses.

Please ensure to also review the link to Overview section for Google Pay™ section to use this SDK.

In order to integrate your Google Pay™ payment solution with Moneris, there are a few basic tasks you need to do:
For Google Pay™ In-App, follow these steps:

  1. Build a demo application for Google Pay™ In-App SDK
  2. Customize your demo app's code to work with the Moneris Gateway
  3. Compile and run your application
  4. Verify the transactions using the Merchant Resource Center.

For additional information on Google Pay™ development, consult Google's developer site:
In-App (Android):

Building a Google Pay™ Demo App

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

  1. Go to Google's Google Pay™ quick start page on Github at
  2. Git clone the Android-Quickstart library to your computer
  3. Unzip the project library
  4. Open Android Studio and import this project as a gradle project
  5. Sync the gradle

Integrating Your Demo App with Moneris Gateway

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

  1. In the file,
    a. set the GATEWAY_TOKENIZATION_NAME to "moneris"
    b. change exampleGatewayMerchantId to your testing Store ID
  2. In the file
    a. in the section LOAD_PAYMENT_DATA_REQUEST_CODE of onActivityResult, replace this code
    PaymentData paymentData = PaymentData.getFromIntent(data);
    with the following field after the PaymentData is received:
    PaymentData paymentData = PaymentData.getFromIntent(data);
    try {
    com.moneris.googlepay.api.Recur recurInfo = new Recur.Builder()
    .setRecurAmount("1.00") // Amount to be sent when managed recur transaction is triggered
    .setStartDate("2018/09/01") // First day the recurring starts
    .setStartNow("false") // true to charge the transaction amount now or false to register the sequence
    .setNumRecurs("5") // Number of recurs
    .setPeriod("day") // The period for the recur, can be "day", "week", "month", or "eom"
    com.moneris.googlepay.api.Purchase purchase = (com.moneris.googlepay.api.Purchase) new
    // Mandatory
    .setOrderId("GooglePayTest-"+new Date().getTime()) // Mandatory, must be unique for all transactions
    .setPaymentData(paymentData) // Mandatory, data returned from Google
    getPriceMicros()+mShippingCost)) // Transaction amount processed
    .setRecur(recurInfo) // Optional, only apply to recurring registration
    .setCustId("Customer 1") // Optional, to display Customer Id for transaction
    // Transaction transport structure
    com.moneris.googlepay.api.MonerisHttpsPost monerisHttpsPost = new com.-
    // Mandatory, should be securely stored.
    ("spedguy") // Mandatory, should be securely stored.
    Page 6 of 22 October 2018
    1 Getting Started With Google Pay™
    // Mandatory from line above
    .setTestMode(true) // Optional, default is testMode false;
    // Send transaction
    com.moneris.googlepay.api.Response resp = monerisHttpsPost.send();
    // Simple test to check if transaction is approved.
    int numRespCode = Integer.parseInt(resp.getResponseCode());
    if ( numRespCode < 50 )
    // Approved complete the transaction.
    } else
    // Declined transaction
    } catch (
    Exception ex)
    Log.e("ERROR", "Failed to send transaction with error: "+ex.getMessage());
    // send -1 for a catch all error

    b. in the code snippet above, change the exampleApiToken value to your testing API token