Skip to main content

Using Google Pay™ with Transact Campus

Overview

Google Pay simplifies the checkout process by enabling customers to use any payment method stored in their Google account. It is compatible with various browsers including Google Chrome, Mozilla Firefox, Apple Safari, Microsoft Edge, Opera, and UCWeb UC Browser. When a customer clicks on Google Pay, they are presented with a list of payment methods stored in their Google account. After selecting a payment method, Google will return a payment token to be used for payment. You can use this encrypted Google Pay payment token as you would in place of card detail fields.

Before You Begin

Contact Transact Campus Support for below items:

  • Enable Google Pay payment method for your client.
  • Obtain your gateway merchant ID.
  • Enable card networks. Transact supported card networks are listed below:
    • MasterCard
    • VISA
    • American Express
    • Discover
    • JCB
  • Obtain Transact checkout API key.
  • Obtain Transact checkout merchant code. Please note that the Transact merchant code differs from the Google merchant ID.

By using the Google Pay API, you accept the Google Pay API Terms of Service.

Google Pay for Web Integration

Getting Started


Requesting Encrypted Token

Make below changes in your request to Google Pay API:

  • gateway - set to transactcampus
  • gatewayMerchantId - a unique merchant identifier used to verify that the message was for the merchant that made the request. Contact Transact Campus for this id.
  • allowedCardNetworks - define the card networks that you wish to allow. Contact Transact Campus to enable it for your merchant.
  • merchantId - Actual Google merchant ID is required only for production environment, for test environment this field can have any dummy value.

Example request with above fields:

const tokenizationSpecification = {
    type: 'PAYMENT_GATEWAY',
    parameters: {
        'gateway': 'transactcampus',
        'gatewayMerchantId' : '[Your gateway merchant ID]'

    }
};

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

paymentDataRequest.merchantInfo = {
    merchantName: 'Example Merchant',
    merchantID: '12345678901234567890'
};

Google Pay for Android Integration

Getting Started

Requesting Encrypted Token

Make below changes in your request to Google Pay API.

  • gateway - set to transactcampus
  • gatewayMerchantId - a unique merchant identifier used to verify that the message was for the merchant that made the request. Contact Transact Campus for this ID.
  • allowedCardNetworks - define the card networks that you wish to allow. Contact Transact Campus to enable it for your merchant.

 

Example request with above fields:

private static JSONObject getGatewayTokenizationSpecification() throws JSONException{
    return new JSONObject(){{
        put("type", "PAYMENT_GATEWAY");
        put("parameters", new JSONObject(){{
            put("gateway", "transactcampus");
            put("gatewayMerchantId", "[Your gateway merchant id]")
        }});
    }};
}

private static JSONArray getAllowedCardNetworks(){
    return new JSONArray()
        .put("AMEX")
        
        .put("DISCOVER")
        .put("JCB")
        .put("MASTERCARD")
        .put("VISA")
}

Completing the Payment with Encrypted Token

Once you have acquired the encrypted Google Pay payment token, it should be included in the request sent to the Transact payment API. The API will decrypt the token and process the payment using the decrypted card details.

Endpoint URL

Request Headers

The following table describes the keys and values of the request headers needed.

KEY VALUE
Content-Typeapplication/json
Authorization
Bearer <your API key>
Reach out to Transact Campus for the API key

 

Request Body

The following table describes the keys and values of the request body structure. Minimum fields required to process the payment is shown below, see API Specification for complete set of fields.

Root Request Structure

KEY VALUE DESCRIPTION
merchantCodestringRequired Transact rapid checkout merchant code.
amountnumberRequired Amount must be in multiples of hundreds.
Example:
  • $0.45 - 45
  • $30.00 - 3000
  • $99.50 - 9950
lineItemsarray[object]
Optional. Line items collection root object. If not passed in the request, merchant’s default item will be used.
See “Line Items” structure below.
googlePayTokenstring
Required Encrypted Google pay payment token.
paymentData.paymentMethodData.tokenizationData.token field value from Google payment response.
Do not modify this value; it must be transmitted unchanged to ensure the payload is successfully decrypted.

Line Items Structure
The following tables describes the keys and values of the Line Items structure.

KEY VALUE DESCRIPTION
itemCodestringRequired
amountnumberRequired Amount must be in multiples of hundreds.
Example:
  • $0.45 - 45
  • $30.00 - 3000
  • $99.50 - 9950

Example Request Body:

// Without line items collection

{
    "merchantCode":"rapid",
    "amount": 1234,
    "googlePayToken": {[Your Google Pay Token]}
}

// With line items collection
{
    "merchantCode":"rapid",
    "amount": 1234,
    "lineItems":[
        {
            "itemCode":"parking-pass",
            "amount": 1234
        }
    ],
    "googlePayToken": {[Your Google Pay Token]}
}

Response Body
The following table describes the keys and values of the response body root elements.

KEY VALUE DESCRIPTION
receiptNumberstringTransact transaction number
paymentMethodIdstringAlways null for Google Pay
amountnumberAmount must be in multiples of hundreds.
Example:
  • $0.45 - 45
  • $30.00 - 3000
  • $99.50 - 9950
customerIdstringCustomer ID passed in the request, otherwise default Transact merchant customer ID.

Example Response Body

{
    "amount":1234,
    "customerId":"default-customer",
    "paymentMethodId":null,
    "receiptId":"6891"
}

 

Deploy Production Environment

Before going live with Google Pay on your web app, you must complete all the steps outlined in the Web Integration Checklist and Web Request Production Access. Follow the step in Web Deploy Your Application to setup your website for the Google Pay production environment and receive chargeable payment methods.

Before going live with Google Pay on your Android app, you must complete all the steps outlined in the Android Integration Checklist and Android Request Production Access. Follow the step in Android Deploy Your Application to configure your app to production and start to accept real payment credentials.

Document Version 1.1 - March 2024