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.
Contact Transact Campus Support for below items:
By using the Google Pay API, you accept the Google Pay API Terms of Service.
Make below changes in your request to Google Pay API:
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'
};
Make below changes in your request to Google Pay API.
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")
}
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.
The following table describes the keys and values of the request headers needed.
KEY | VALUE |
---|---|
Content-Type | application/json |
Authorization | Bearer <your API key> Reach out to Transact Campus for the API key |
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 |
---|---|---|
merchantCode | string | Required Transact rapid checkout merchant code. |
amount | number | Required Amount must be in multiples of hundreds. Example:
|
lineItems | array[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. |
googlePayToken | string | 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 |
---|---|---|
itemCode | string | Required |
amount | number | Required Amount must be in multiples of hundreds. Example:
|
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 |
---|---|---|
receiptNumber | string | Transact transaction number |
paymentMethodId | string | Always null for Google Pay |
amount | number | Amount must be in multiples of hundreds. Example:
|
customerId | string | Customer ID passed in the request, otherwise default Transact merchant customer ID. |
Example Response Body
{
"amount":1234,
"customerId":"default-customer",
"paymentMethodId":null,
"receiptId":"6891"
}
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.