1. General information

_images/GPay_Logo.svg.png

Google Pay™ is an electronic wallet system that allows you to make an intuitive payment using a card number saved in a secure way in Google services. As part of Google Pay payment you don’t need to enter card numbers during transaction and access to the payment mechanism is possible from any device.

After choosing Google Pay payment method in store, client will see on the screen the form on which he confirms his Google account and card he is going to use to pay for order. If customer didn’t have a previously registered card, he may do it while making payment.

Important

If you use the Dotpay website to select a payment channel, or in order to make a payment you transfer the payer to Dotpay, you do not need to make any technical changes. Remember that the Google Pay channel is available to you, your account must be able to process card payments. If you do not have it, please contact Dotpay Sales Department.

This manual applies only to Partners who want to place the payment button with Google in the cart of their own store.

2. Description of functionality

2.1. Security

Card data is stored in a Google account, which is multi-layered secured and above all isn’t available for Store.

2.1.1. Payment process Google Pay - diagram

@startuml caption The Payment process Google Pay -> Dotpay


skinparam handwritten false
skinparam style strictuml
autonumber


skinparam note {
    BackgroundColor #F1FFFF
    BorderColor #2980B9
}

skinparam actorBackgroundColor #FEFECE
skinparam actorBorderColor    Maroon
skinparam ActorFontColor DarkRed
skinparam ActorFontSize 17
skinparam ActorFontName Aapex


skinparam sequence {
    ArrowColor DeepSkyBlue
    LifeLineBorderColor blue
    LifeLineBackgroundColor #A9DCDF

    ParticipantBorderColor DeepSkyBlue
    ParticipantBackgroundColor DodgerBlue
    ParticipantFontName Impact
    ParticipantFontSize 17
    ParticipantFontColor #d2eeef

}

participant "Google" as Google
actor "Payer" as Klient
participant "Shop" as Akceptant
participant "Dotpay" as Dotpay
participant "Acquirer" as Acquirer




Klient -> Akceptant: Choosing the Google Pay method

Akceptant -> Google: The shop sends a token request to Google

Google -> Akceptant: Google returns the token to the shop

Akceptant [#4468aa,dashed]--> Akceptant: Token encode to Base64

Akceptant -> Dotpay: Encoded token sent\n in the 'gp token' parameter

Dotpay [#4468aa,dashed]--> Dotpay: Decrypting card data

Dotpay -> Acquirer: An attempt to charge credit card

Acquirer -> Dotpay: Information on the status\n of the transaction

Dotpay -> Akceptant: URLC notification with\n transaction status

Akceptant -> Klient: Confirmation of the transaction


@enduml

2.1.2. Description of payment process:

  1. Payer selects Google Pay payment method

  2. Merchant sends a token request to Google server

  3. Google passes the response with value of transaction token

  4. Shop encodes the resulting token using Base64

  5. The shop transfers to Dotpay encoded token in the parameter gp_token along with other data necessary to initiate payment

  6. Dotpay is decrypting card data

  7. Dotpay performs an attempt to charge your card in bank card issuer

  8. Information about result of charge test is returned to Dotpay

  9. Dotpay sends confirmation of payment to Merchant in accordance with account settings (eg URLC notification, email notification)

  10. The merchant confirms transaction status to Customer.

3. Integration Google Pay™ payments

Integrating Google Pay comes down to three steps:

  • Integration with Google Pay

  • Receiving a payment card token

  • Sending a request to Dotpay with complet of necessary data and token obtained from Google Pay, previously encoded with the Base64 function

To begin processing Google Pay payments you must firstly integrate directly with Google. After integration you can add the Google Pay button to checkout page and process encrypted customer data.

3.1. Refer to documentation Google Pay

Note

In order to implement payments from Google Pay directly on store website, firstly read following documentation: https://developers.google.com/pay/api/web/guides/tutorial

Before starting production Google Pay every seller must register with Google, accept the Terms of Service and receive from Google seller ID.

If you confirm that all required steps in integration have been made from the integration checklist, then you can click Request production access to begin the process of obtaining production access.

3.2. Collection of necessary information from Dotpay

In order to correctly configure Google Pay on Merchant website, you must download necessary information from Dotpay to help you configure service.

You can use Api Dotpay to download a list of channels, which additionally allows you to return for given store ( id ) right parameters to configure service.

Note

Description of method allowing to download the list of channels and their configuration can be found in Technical manual for payments implementation while describing parameter channel .

Example:

Dotpay API: downloading channel list and their configuration
 GET https://ssl.dotpay.pl/t2/payment_api/channels/?id=123456&amount=100.00&currency=PLN&lang=pl&format=json
Api Dotpay - channel configuration
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
channels: [

    {
        "id": 260,
        "name": "Google Pay",
        "logo": "https://ssl.dotpay.pl/test_payment/cloudfs2/magellan_media/payment_channel_logo/5c8637e8eb0a1937424941cd/",
        "group": "credit_cards",
        "group_name": "Karty płatnicze",
        "short_name": "Google Pay",
        "is_disable": "False",
        "is_not_online": "False",
        "warranty_available": false,
        "form_names": [
            "personal_data",
            "agreement"
        ],
        "config": {
            "type": "google_pay",
            "data": {
              "gp_gateway": "dotpay",
              "gp_script_url": "https://pay.google.com/gp/p/js/pay.js",
              "gp_environment": "TEST",
              "gp_gateway_merchant_id": "123456",
              "gp_protocol_version": "ECv2",
              "gp_api_version": "2",
              "gp_auth_methods": [ "PAN_ONLY" ],
              "gp_merchant_name": "My Company Name",
              "gp_currency_code": "PLN",
              "gp_merchant_id": "04619821273743693712",
              "gp_total_price": "150.00",
              "gp_card_brands": [ "MASTERCARD","VISA" ],
              "gp_api_version_minor": "0"
            }
          }
    },
]

3.3. Configuration of Google Pay

3.3.1. Step 1 Google Pay: Specify Google Pay API version

Data for Google Pay was used, according to Api Dotpay - channel configuration :

config: { data: { gp_api_version, gp_api_version_minor } }

Google Pay API: Google Pay Api version
const baseRequest = {
    apiVersion: 2,    // 'gp_api_version' from Dotpay Api
    apiVersionMinor: 0    // 'gp_api_version_minor' from Dotpay Api
  };

3.3.2. Step 2 Google Pay: Choose a payment tokenization method

Data for Google Pay was used, according to Api Dotpay - channel configuration :

config: { data: { gp_gateway, gp_gateway_merchant_id } }

Google Pay API: parameter tokenization method
const tokenizationSpecification = {
  type: 'PAYMENT_GATEWAY',
  parameters: {
    'gateway': 'dotpay',    // 'gateway' from Dotpay Api
    'gatewayMerchantId': '123456'   // 'gp_gateway_merchant_id' from Dotpay Api
  }
};

3.3.3. Step 3 Google Pay: Specify supported payment card networks

Data for Google Pay was used, according to Api Dotpay - channel configuration :

config: { data: { gp_card_brands } }

Google Pay API: supported cards
const allowedCardNetworks = ["MASTERCARD", "VISA"];      // 'gp_card_brands' from Dotpay Api
Google Pay API: currently supported card authorization method
const allowedCardAuthMethods = ["PAN_ONLY"];    // 'gp_auth_methods' from Dotpay Api

3.3.4. Step 4 Google Pay: Describe the allowed forms of payment

Follow description of this step in Google Pay documentation


3.3.5. Step 5 Google Pay: Load JavaScript library Google Pay API

Data for Google Pay was used, according to Api Dotpay - channel configuration :

config: { data: { gp_script_url } }

Google Pay API: load js Google Pay API library
     <script
     async
     src="https://pay.google.com/gp/p/js/pay.js"
     onload="console.log('TODO: add onload function')">
     </script>

     <!-- use the value from Dotpay Api (param: 'gp_script_url')  to 'src'  -->

Specify Google Pay environment type.

Data for Google Pay was used, according to Api Dotpay - channel configuration :

config: { data: { gp_environment } }

Google Pay API: specify environment type
     const paymentsClient =
         new google.payments.api.PaymentsClient({environment: 'PRODUCTION'});      // 'gp_environment' from Dotpay Api

3.4. Receiving a payment card token

After calling correctly configured Google Pay script, token similar to following will be returned to store:

 {
  "signature":"MEQCIFCJnLAb5FNt7x0OBu8xOyWQ2+2jqAhj+lP1vhjaJHVNAiBGDTp2OT93Mc1W52zUQaZ+UR0Zb44++9A7sga4aQAIVQ\u003d\u0034d",
  "intermediateSigningKey":{
         "signedKey":"{\"keyValue\":\"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/2u5JqEr0QqKSR/mATqeKkLcUVJVuN8T9ePL9nVKXXDSCksbg5r7jf0b4r5dA3+2lCPUy3lFMoMILxZV3aGxHg\\u003d\\u003d\",\"keyExpiration\":\"1550936472498\"}",
         "signatures":[
                "MEYCIQDuO/OWef7yHqS7giNytFPEvOFX12HFXtBDP1zTEV+0iQIhAN1otbxYwkjApDBRAH5MZkpzXcKYMCMIHhD2OnnOqCmW"
         ]
  },
  "protocolVersion":"ECv2",
  "signedMessage":"{\"encryptedMessage\":\"fFsjd2QBg11M/h9ZHQtXd+yhsaa3XXPeZwYKAF+RF2t8FvmRvJ0o1sVmLrxM743UrcZtihjiuvMGP0pia0jpZ6plSiiPQfy6gX+/41mfUYhQ4ICpJa5AXZvAN4Q0btwLeCrpaB0kfF2PFEF2lURsMluymM8dhZtGUffGRnhpZIPawuH3QHAaJfb/bdjhi5xKbKH9X+aMLYC7C6ZjtHm9Ano/pjqEufjb3aGSoVaXOBNy1xYst+CLTOLKvLo8O5GnvZIjxw7w5tMOtG//ZW3Xe4BXWO7K9xFVjaFl+5S0pZEcg9auz8UQHmnVu8u0PvJvQJA2tY9PXSeRrfQ1MOeJugW9wuXX8cTD4lzDy3y4MF2CnarRDD8iFl/CdMza5EV8da7Z76AsAW7xJjmvJ6gtl2J/+rsMg+wPWGwQ044HSQ3PTgndWBYV45TOgWuc25GV9Om8zXrtDlZWkDiKKSdRer9ORJxtkJ5cBawc\\u003d\",\"ephemeralPublicKey\":\"BDHO5r+LJUb1+dOm1yGfm4w19EBaMXQJH5smFQwvVSmaWWLaDeBX9xQuUvCOmNBHi1zA1ATc1oROIVX9A1Rkq/w\\u003d\",\"tag\":\"fsPXn4u3L2nlceG7fPG2fnXtQwAUgR6lC6btBMvR1Lc\\u003d\"}"
}

Its contents should capture, encode using Base64 ** ** and then placed in an additional parameter gp_token and sent along with other standard payment details to Dotpay.

Example:

gp_token = eyJzaWduYXR1cmUiOiJNRVFDSUZDSm5MQWI1Rk50N3gwT0J1OHhPeVdRMisyanFBaGorbFAxdmhqYUpIVk5BaUJHRFRwMk9UOTNNYzFXNTJ6VVFhWitVUjBaYjQ0Kys5QTdzZ2E0YVFBSVZRPTRkIiwiaW50ZXJtZWRpYXRlU2lnbmluZ0tleSI6eyJzaWduZWRLZXkiOiJ7XCJrZXlWYWx1ZVwiOlwiTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFLzJ1NUpxRXIwUXFLU1IvbUFUcWVLa0xjVVZKVnVOOFQ5ZVBMOW5WS1hYRFNDa3NiZzVyN2pmMGI0cjVkQTMrMmxDUFV5M2xGTW9NSUx4WlYzYUd4SGdcXHUwMDNkXFx1MDAzZFwiLFwia2V5RXhwaXJhdGlvblwiOlwiMTU1MDkzNjQ3MjQ5OFwifSIsInNpZ25hdHVyZXMiOlsiTUVZQ0lRRHVPL09XZWY3eUhxUzdnaU55dEZQRXZPRlgxMkhGWHRCRFAxelR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dTAwM2RcIn0ifQ==

Attention

Google Pay doesn’t allow configuration of test cards in its online wallet. Simulation of payments (also within test environment) requires using real card data.

In spite of providing the real data of the card, when paying in test mode they will not be transferred to Dotpay, the card will not be charged as well.

4. Creating transactions in Dotpay

After properly receiving token from Google Pay you can attempt to charge customer card. To do this you must do a proper "redirection" or use "api register order" from Merchant’s store to Dotpay with the necessary data.

4.1. An example of using parameters initiating payment in Dotpay

Form generator in PHP initiating redirection to Dotpay - creating payment
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

$EnvironmentAddress = 'https://ssl.dotpay.pl/test_payment/';  // Dotpay test Environment

//$EnvironmentAddress = 'https://ssl.dotpay.pl/t2/';  //Dotpay production Environment



//-- Sample data sent to Dotpay with a card token in the 'gp_token' parameter --//

$ParametersArray = array(
    'id' => 123456,
    'type' => 4,
    'channel' => 260,
    'api_version' => 'dev',
    'amount' => '100.00',
    'currency' => 'PLN',
    'description' => 'Order no. 567915976',
    'control' => 'M1231MzaUdLQWR3',
    'url' => 'https://www.example.com/thanks_page.php',
    'urlc' => 'https://www.example.com/urlc_receiver.php',
    'firstname' => 'Jan',
    'lastname' => 'Nowak',
    'email' => 'jan.nowak@example.com',
    'gp_token' => 'eyJzaWduYXR1cmUiOiJNRVFDSUZDSm5MQWI1Rk50N3gwT0J1OHhPeVdRMisyanFBaGorbFAxdmhqYUpIVk5BaUJHRFRwMk9UOTNNYzFXNTJ6VVFhWitVUjBaYjQ0Kys5QTdzZ2E0YVFBSVZRPTRkIiwiaW50ZXJtZWRpYXRlU2lnbmluZ0tleSI6eyJzaWduZWRLZXkiOiJ7XCJrZXlWYWx1ZVwiOlwiTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFLzJ1NUpxRXIwUXFLU1IvbUFUcWVLa0xjVVZKVnVOOFQ5ZVBMO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YWxQdWJsaWNLZXlcIjpcIkJESE81citMSlViMStkT20xeUdmbTR3MTlFQmFNWFFKSDVzbUZRd3ZWU21hV1dMYURlQlg5eFF1VXZDT21OQkhpMXpBMUFUYzFvUk9JVlg5QTFSa3Evd1xcdTAwM2RcIixcInRhZ1wiOlwiZnNQWG40dTNMMm5sY2VHN2ZQRzJmblh0UXdBVWdSNmxDNmJ0Qk12UjFMY1xcdTAwM2RcIn0ifQ==',
    'chk' => 'ba18d9890335b9d59a0e35a00c788214996a9f980a3b7e5d8d900306a7545dcb'
);



//--  generate a form   --/

    $RedirectionCode = '<form action="'.$EnvironmentAddress.'" method="POST" id="dotpay_redirection_form" accept-charset="UTF-8">'.PHP_EOL;

        foreach ($ParametersArray as $key => $value) {
            $RedirectionCode .= "\t".'<input name="'.$key.'" value="'.$value.'" type="hidden"/>'.PHP_EOL;
        }
        
    $RedirectionCode .= '</form>'.PHP_EOL.'<button id="dotpay_redirection_button" type="submit" form="dotpay_redirection_form" value="Submit">Confirm and Pay</button>'.PHP_EOL;



//--  print a form   --/

echo $RedirectionCode;


?>

5. Integration for Android

Google Pay allows you to integrate payments on Android.

To integrate the mobile application with the Google Pay method, please follow the instructions on this page: https://developers.google.com/pay/api/android

To check if all the required steps in the integration with Android have been made, use the checklist available at: https://developers.google.com/pay/api/android/guides/test-and-deploy/integration-checklist

6. Additional information

6.1. Tips for the Google Pay brand

Guidelines (buttons, styles, signs) that will help you correctly place Google Pay brand elements on websites and mobile applications can be found at: https://developers.google.com/pay/api/web/guides/brand-guidelines

Use these tips to be consistent and follow Google’s recommendations when implementing Google Pay.

6.2. Creating a mobile application

For information on recommendations when creating a mobile application with the Google Pay API interface, please visit:

https://developers.google.com/pay/api/android/guides/tutorial