Skip to content

Google Pay in your mobile application

If you want to accept payments with the Google Pay button in your mobile application, follow the steps below:

1. Register in Google.

Register your application in Google Pay Business Console.

Info

Review and adhere to Google Pay policies and terms of service and refer to Google Pay Brand Guidelines to display the Google Pay button correctly.

2. Get the payment method token from Google Pay.

Use the following parameters at Steps 2 - 4 of Google Pay API Tutorial:

Parameter Type Description
type * required
string payment_gateway
gateway * required
string {psp.google_pay.gateway_id}
gatewayMerchantId * required
string Shop ID in the bePaid system.
supported Networks * required
array visa, masterCard
supported authorization methods * required
array PAN_ONLY, CRYPTOGRAM_3DS
BillingAddressParameters object Billing address parameters are not necessary for processing via the bePaid API.

Info

If you need assistance, refer to Google Pay implementation example.

Example of the request parameters
const baseRequest = {
  apiVersion: 2,
  apiVersionMinor: 0
};

const tokenizationSpecification = {
  type: 'payment_gateway',
  parameters: {
    'gateway': '{psp.google_pay.gateway_id}',
    'gatewayMerchantId': 'exampleGatewayMerchantId'
  }
};

const allowedCardNetworks = ["MASTERCARD", "VISA"];

const allowedCardAuthMethods = ["PAN_ONLY", "CRYPTOGRAM_3DS"];
Example of the response for Google Pay API version 2.0 for a card payment
{
  "apiVersion": 2,
  "apiVersionMinor": 0,
  "paymentMethodData": {
    "type": "CARD",
    "description": "Visa •••• 1234",
    "info": {
      "cardNetwork": "VISA",
      "cardDetails": "1234"
    },
    "tokenizationData": {
      "type": "PAYMENT_GATEWAY",
      "token": "examplePaymentMethodToken"
    }
  }
}

3. Send the payment request to bePaid

Request

Send a payment, authorization or charge request, where you should submit the encrypted Google Pay token as the value of request.credit_card.token in the format described below.

The required format of the encrypted Google Pay token sent as the card token

Submit the encrypted Google Pay token in requests as the card token in the $begateway_google_pay_1_0_0$<base64_PaymentToken_here> format, where:

  • $begateway_google_pay_1_0_0$ is the required prefix for the encrypted Google Pay token;
  • <base64_PaymentToken_here> is the received Google Pay token (paymentMethodData.tokenizationData.token for Google Pay API version 2.0) in the JSON format converted to the Base64-strict format.

For recurring payments and payments with the saved card data, get the bePaid payment token by sending the request.additional_data.contract parameter in the payment, authorization or charge requests.

Example of the payment request with the encrypted Google Pay token
{
  "request": {
    "amount": 100,
    "currency": "USD",
    "description": "Google Pay test transaction",
    "tracking_id": "your_uniq_number",
    "credit_card": {
      "token": "$begateway_google_pay_1_0_0$eyJzaWduYXR1cmUiOiJNRVlDSVFES2R2dFlEVFdNemh1MVhNanNTdlgxZzJFek1hdFN5Z3J3QVU0cFpyd2tnUUloQUlEMzRtUGdMa1pRU1ZvbUptSjNyM3NKZ1ZveFc5eVpIUnR6QkVjOVZiTHIiLCJpbnRlcm1lZGlhdGVTaWduaW5nS2V5Ijp7InNpZ25lZEtleSI6IntcImtleVZhbHVlXCI6XCJNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUV5cUdEYUxLN3lvVWJGWVRFWnQzaHhPTTlPckZacFUyenJJTXJ3WWhuV25HbksraDkvWWFHNllnczBUcWp0eGhFcExDUVl1RVpuTFM5S3RlN0xWRlJaUVxcdTAwM2RcXHUwMDNkXCIsXCJrZXlFeHBpcmF0aW9uXCI6XCIxNTk4NDg4NzUxMTg5XCJ9Iiwic2lnbmF0dXJlcyI6WyJNRVFDSUJmRWdXVmtxN0FtSlp2WmhpQ3hKazBPNUV6Z042NWt4dXZmb2dSM3YxT1dBaUFnd1VnMXZuWGFlK2JXM0NtbWhvRFEvTFFIcG9leUZINFNGQk9jOXBVeS93XFx1MDAzZFxcdTAwM2QiXX0sInByb3RvY29sVmVyc2lvbiI6IkVDdjIiLCJzaWduZWRNZXNzYWdlIjoie1wiZW5jcnlwdGVkTWVzc2FnZVwiOlwiY1BkQmZwbjJpa3dSSThVYWIzQTIrM0lIVitQMEZSMlFzbjNwTG9FK2NYeTZiMnE4V2R4S1gyWi9QY3M4b3JMc0toL2FsT05HZmE1RzJmMkVTK0xjNWVEWnc0YlN5aXFUb09XK2NkQjVLNFNSUUVFSkV2WitoanVvUmVINU8zakZxUXhNYk44V3V5aXlrMzlUQnZyUmQ4MXptNEEvOVkrOEdFU1NDNVhSRUd1Skk1Y2VoRzZKUDZBVnArUnpmZVAzM09INTd1dWlVdldYamsvQXZUb0VmUXprTDM3ZUJKdFI0eWRTWnhNam9zcFN5cU5CenlKZDk3RDNydkZMRmdoZGdrQ1ozMEZRbDc4NGdBelpQVVhkVDBMNW5WZnFXNGxZMHU3VTdiRGxNekxYdWErcTdZU2JQOWFtN0Z0Y2F2LzFKUjBvM1Q2clYzR1ZDdjQ1Q3lQclI1NkN0aU4xZUdONmxsUlRuTDhVMVdZY2JOQWJLQlRkTnhKTlljN2FMQTZCaUYwc01LQWdid2ltK2U5UWR2UzV6ZDJwcVJ1ZTJiYkRsVnBsdSs3ZE1WMWlJTVpVQ3JYRHFROHE3RzQvK3lLWmp6dHk1RDlYS29aSVZzeXFOUFlQTnJaRDdJQ0w5QVxcdTAwM2RcXHUwMDNkIiwiZXBoZW1lcmFsUHVibGljS2V5IjoiQklpOTRmUUhGV0NVVWYrWms0cHdLWEJXTlc5a0d5WTlJQkJrb3ZqZS9kNkJULzZaMjdTeURueFFGS0xOTWRtaUZZcXhkRko3clNkeTRqMTMrNTM3cTRJXFx1MDAzZCIsInRhZyI6InpwZXQ1SHVmbk01WXJOWHdQSjRQQ1lBWU1MeG4vMzNZaDkzNzhLZU1Ba3dcXHUwMDNkIn0ifQ=="
    }
  }
}
Response

The response to the payment request with Google Pay token will be returned with transaction processing statuses. It fully matches the responses to payment or authorization requests.