Google Pay™

This is the Google Pay™ integration guide. Please consult the official page for detailed information.

To process live transactions merchants should register at g.co/pay/sign-up

Common steps for all integration methods

  1. Use the Google Pay Web developer documentation as guideline for your integration.

  2. Consult the Brand guidelines and UX best practices for web pages to properly design your checkout page and integrate the google pay button.

  3. Go through the Integration checklist to make sure that all requirements for accepting Google Pay are met.

  4. Read and adhere to the Google Pay APIs Acceptable Use Policy and accept the terms defined in the Google Pay API Terms of Service.

  5. In most cases Google Pay will return appropriate payment credentials for transactions subject to Strong Customer Authentication (SCA). If this is not possible (PAN_ONLY method) the SCA will be performed as for plain credit-card payments. The customer will be redirected to complete the payment - the AcceptPayment operation will return returnCode=REDIRECT and location containing the URL where the customer should be redirected. Refer to this link for more information.

  6. Implement the CreateGooglePayToken SOAP operation. The operation is similar to the CreatePaymentToken but the amount and currency should be provided.

Request Example:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:etp="https://www.mpay24.com/soap/etp/1.5/ETP.wsdl">
  <soap:Body>
    <etp:CreateGooglePayToken>
      <merchantID>{merchant}</merchantID>
      <amount>{amount}</amount>
      <currency>{currency}</currency>
      <order>
        <description>{description}</description>
      </order>
    </etp:CreateGooglePayToken>
  </soap:Body>
</soap:Envelope>

The order structure could be used to specify shopping card content and billing / shipping addresses which will be used in future versions.

Response example:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:etp="https://www.mpay24.com/soap/etp/1.5/ETP.wsdl">
  <soap:Body>
    <etp:CreateGooglePayTokenResponse>
      <status>OK</status>
      <returnCode>OK</returnCode>
      <token>klmAAzHVYh0vuu5O1y6JSrmBvLy1gs7fOg7FnLixRbY=</token>
      <apiKey>7506491b91257aad8da277f4565b8c50e80315674232aaa7d9ae1ead86dcd75d</apiKey>
    </etp:CreateGooglePayTokenResponse>
  </soap:Body>
</soap:Envelope>

The returned token is used for the AcceptPayment operation (the actual payment) and the apiKey is used to initialize the GooglePayAPI class in the client browser or direct calling the Unzer Austria tokenization API.

Integration in a Web-Page

  1. Integrate the Google Pay API in your payment page:
  • Include the Google Pay and Unzer Austria API JavaScript in your payment page:
<script src="https://pay.google.com/gp/p/js/pay.js"></script>
<script src="https://www.mpay24.com/app/tokenizer/default/js/googlepay.js"></script>
  • Initialize the Google Pay client. Initial development uses a TEST environment, which returns dummy payment methods that are suitable to reference the structure of a payment response. For production use, the environment should be changed to PRODUCTION (details here).
var gpAPI = undefined;
var gpPaymentsClient = new google.payments.api.PaymentsClient({ environment: 'PRODUCTION' });
  • Initialize the Unzer Austria API with the apiKey and check if Google Pay is available by calling the isReadyToPay (details here). Create the google pay button by calling createButton (details here) and attach the button to your pay page. Reference the onClick function which will be called when the button is clicked. On button click, generate the payment request with the getPaymentRequest and initiate the payment by calling loadPaymentData (details here). Finally process the payment data using processPayment. This will validate, decrypt and store the payment token.
async function isReadyToPay() {
      const request = await gpAPI.getIsReadyToPayRequest();
      const response = await gpPaymentsClient.isReadyToPay(request);
      return (response.result === true && response.paymentMethodPresent === true)
    }
    
    async function onPaymentButtonClicked() {
      try {
        const request = await gpAPI.getPaymentRequest();
        const paymentData = await gpPaymentsClient.loadPaymentData(request);
        const response = await gpAPI.processPayment(paymentData);
        if (response && response.status === 0) {
          ... // success
        }
      }
      catch (err) {
        ...
      }
    }

    async function initialize() {
      try {
        gpAPI = new GooglePayAPI(apiKey);
        const ready = await isReadyToPay();
        if (ready) {
          const button = gpPaymentsClient.createButton({
            buttonType: 'plain',
            onClick: onPaymentButtonClicked
          });
          if (button) {
            const element = document.getElementById('button');
            element.appendChild(button);
          }
        }
      }
      catch (err) {
        ...
      }
    }
  1. When the payment is authorized by the customer and the token ist validated and stored, proceed with AcceptPayment as with credit-cards. The amount and currency should be the same as in the CreateGooglePayToken SOAP operation or the payment request will be declined.

Direct usage of the tokenization API

The Unzer Austria tokenization API can be used directly if the provided JavaScript is not suitable for the desired integration.

Consider following when generating or modifying the PaymentDataRequest (see the example below):

  • The gateway (string) property should be set to unzeraustria which is registered at Google as PSP.
  • The gatewayMerchantId (string) property should be set to your 5-digit Unzer Austria merchant identification used in the CreateGooglePayToken SOAP operation.
  • The allowedCardNetworks (string[ ]) property should contain card networks enabled on the Unzer Austria platform.
  • The merchantId (string) property should be set to the value obtained from the Google Pay Business Console. See Request production access for more information about the approval process and how to obtain a Google merchant identifier.
  • The amount and currency should match those provided in CreateGooglePayToken SOAP operation.
  • The billing address is not required (will be used in future versions).

Follow these steps to integrate the API directly:

  1. The API is accessible under following url:
https://www.mpay24.com/app/bin/tokenizer/api/v1/googlepay/{resource}
  1. The client should be authenticated using following HTTP headers and the apiKey from the CreateGooglePayToken SOAP operation in order to call the API :
Content-Type: application/json;charset=utf-8
Api-Key: 7506491b91257aad8da277f4565b8c50e80315674232aaa7d9ae1ead86dcd75d
  1. Following resources can be used with the POST method:
  • getPaymentRequest (optional) can be used for creation of the PaymentDataRequest according to the merchant configured payment methods and the data provided in the CreateGooglePayToken call.
    The (POST) request is currently not used and should be empty.

Response Example:

{
  "apiVersion": 2,
  "apiVersionMinor": 0,
  "merchantInfo": {
    "merchantId": "exampe-id",
    "merchantName": "Example Merchant"
  },
  "allowedPaymentMethods": [
    {
      "type": "CARD",
      "parameters": {
        "allowedAuthMethods": ["PAN_ONLY", "CRYPTOGRAM_3DS"],
        "allowedCardNetworks": ["MASTERCARD", "VISA"]
      },
      "tokenizationSpecification": {
        "type": "PAYMENT_GATEWAY",
        "parameters": {
          "gateway": "unzeraustria",
          "gatewayMerchantId": "7xxxx"
        }
      }
    }
  ],
  "transactionInfo": {
    "countryCode": "AT",
    "currencyCode": "EUR",
    "totalPriceStatus": "FINAL",
    "totalPrice": "12.34",
  }
}
  • processPayment (required) should be used for validating and decoding the PaymentData returned by Google after a payer approves the payment.

Request Example:

{
    "paymentData": {
        "apiVersionMinor": "0",
        "apiVersion": "2",
        "paymentMethodData": {
            "description": "Visa •••• 1111",
            "tokenizationData": {
                "type": "PAYMENT_GATEWAY",
                "token": "{\"signature\":\"MEQCICCa7Ty8Ta9CNir7RXtZ9+p+Bxr7MUCYUobwbMVqWaoFAiAkxgA+bnHLlm9eM0DcT1rC531m+AfAqvScC4b5KpeN3Q\\u003d\\u003d\",\"intermediateSigningKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErl7GHoxOxwxafrUeWIPPIHvUs7oNnV8uVcBObBYadPoiJOTA0dW2UdycUQ+NxaDV1ivPKG3jnYeV93S18LmmQg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"1640928100748\\\"}\",\"signatures\":[\"MEUCIC/J4lZsrFEKVnxT44Tm9GKMLidzXYFCXWc9nnlRtTzBAiEAkSduaWMFp3TKbsScJsHrF4BVbv+p56N6I7/tfVKWv2Q\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"s/GUKC1OkJFdhXJqFd9JoztjO9NlK7WVee8nWMnTErhh6aCnvJMjx8mddggb6GWAJiOQLBWXv7YN1Tf249vd8l1kt3AxBb/iiYQWwolbw8A6jU/ZWFonJbdQTXbPErxgn3tr7bSDc23dZIp7lRCLQTOwxlBp4pCS25gYkIs38XwaaDkSWcT4EQYenl1z7d4f+9cZpBe4+COJGrNYkNSXBlRhFxKYWJEJ2V5jIxaAV3IBy5Is+rCx3InQiOnG4cdOIF2Utj0DRovVgeNsw3bynYNwUIYDKJp3Z4oRPjB72zpQx0lK3aXtY/bkO90yKwhUIoyd71W/n0+ZwfnKFQMrCNVMSyUYnhjzV1c0zMhnRjATW60/TUYFL4AASF2j1If8lhwH+exrXtqqGlpWlW/hicKSGMRiZpVuBW5M+LxNR4owGSrRmeRvp8fQd5EryRqlvVKoE6Uy4aVGnGSn5oqEm1UZx7Pa2lyqEnQKv7TpirTa0nVrWYh0amVgaeTGTPref3m4vaCAIKHk+FsiJ+DM1oXEN3F4x48s5oidWL8nvh8yAMoy1bWzV+nKHqnzwmWi5yyb0w\\\\u003d\\\\u003d\\\",\\\"ephemeralPublicKey\\\":\\\"BNpINCFF092Ho2NWrfdT8EkQrXTx56yBcmwVvdd4OuvLsHCXrlk1ukcBm+F59BxSLoSXJIyxjv4KWbkwSjLEFtY\\\\u003d\\\",\\\"tag\\\":\\\"o4CEJg3Wb+SxRFxNZoZtj/k/izgxMG0mF67UZbLbqDM\\\\u003d\\\"}\"}"
            },
            "type": "CARD",
            "info": {
                "cardNetwork": "VISA",
                "cardDetails": "1111"
            }
        }
    }
}

Response Example:

{
    "status": "0"
}
  1. When the payment is authorized by the customer proceed with AcceptPayment as with credit-cards. The amount and currency should be the same as in the CreateGooglePayToken SOAP operation or the payment request will be declined.