Using Google Pay for Web

Google Pay allows you to make secure payments using an internet browser.

The following articles help you with Google Pay payment method.

Prerequisites

Follow the prerequisites below before you incorporate Google Pay on your website:

  • Serve an HTTPS webpage with a TLS domain-validated certificate.

  • Use one of the following supported web browsers:

    • Google Chrome

    • Mozilla Firefox

    • Apple Safari

    • Microsoft Edge

    • Opera

    • UCWeb

  • Add a payment method to your Google account using the Getting Started with Google Pay reference.

  • Implement the manual card entry of the JavaScript SDK solution.

Supported Payment Methods

You must have the payment and address information of your customers who use Google Pay.

Supported Cards

  • Visa

  • MasterCard

  • American Express

  • Discover

Merchant Capabilities

  • Credit cards (Visa or Mastercard)

  • Debit cards (Visa or Mastercard)

Getting Started

Follow the below steps to start using the Google Pay on your website:

1

Create a request object and a buttonConfig object using the Brand Guidelines by Google reference before you call our init function.

2

Add the function below to your website to check whether your customer uses Google Pay.

This function helps you decide whether to display the Google Pay button in the customer’s browser.

ClearentSDK.googlePayAvailable()

Configuring the onClick Event

Follow the below steps to configure the onClick event for your payment process:

1

Start the Google Pay session using the init function below.

const request = {
	"total": {
		"label": "Sasha's Mustard Shop",
		"amount": "0.01",
		"type": "final"
	}
};
const buttonConfig = {
	"buttonColor": "default",
	"buttonType": "buy",
	"buttonLocale": "en",
	"buttonSizeMode": "fill"
};
ClearentSDK.init({
	"baseUrl": "https://gateway-sb.clearent.net",
	"pk": "Your public key",
	"enableGooglePay": true,
	"googlePayRequest": request,
	"googlePayButtonConfig": buttonConfig
});
2

Clearent’s JavaScript SDK handles the Apple Pay token and converts it into the JWT that you process.

<script type="text/javascript">
            // When you get a successful token response and
            // use this to make a sale/auth on your backend
            function ClearentTokenSuccess(raw, json) {
                console.log("ClearentTokenSuccess");
                console.log(raw);
                console.log(json);
                // now you can send the token to your server
                // to complete the transaction via mobile-gateway
            }
            function ClearentTokenError(raw, json) {
                console.log("ClearentTokenError");
                console.log(raw);
                console.log(json);
            }
        </script>
3

Send the token provided by Clearent to your server using the secure transmission.

4

Provide the secret API key to Clearent from your server.

5

Return a successful token response you receive to the JavaScript SDK to handle it appropriately.

Last updated

Was this helpful?