Google Pay
- Initiate Authorization
- Collect Payment Option Details via KC UPCF Web SDK
- Google Pay™ Checkout and Payment Confirmation
- Complete Authorization
1. Initiate Authorization
The authorization of a payment is initialized by calling the API method 1.38 Init Authorize.
In the example below, we authorize 100 EUR for a Google Pay™ payment as part of the purchase of two premium widgets from Widgets GmbH.
Initiate Authorization Request
Path:
PUT {baseURL}/payment/initAuthorize
Header:
Content-Type: application/json
Accept-Language: en-US
X-Auth-Token: eyJjb25uZW***AwMjZ2PTQifQ==
User-Agent: ***
{
"partnerReference": "eb9640b0-f731-4abf-8752-37e8280c9ee9",
"programAccno": "7228894817",
"accno": "7228905548",
"accnoType": "01",
"presentationAmount": 100,
"presentationCurrCode": "EUR",
"presentationUsage": "V Purchase:2xPremiumWidgets. Merchant:WidgetsGmbH. CUSTREF:52650FD95.",
"useDifferentBillingAddress": false,
"paymentOptionCode": "GGLPAY",
"criteria": [
{
"name": "googleButtonType",
"value": "plain"
},
{
"name": "googleButtonStyle",
"value": "white"
}
],
"localDate": "2025-01-28",
"localTime": "125849"
}
The parameter useDifferentBillingAddress
determines whether customer account data is loaded from the technical account. If set to false, the system will automatically obtain billing address data from the technical account. If set to true, the data must be explicitly provided in the request at the root level. Below is an example demonstrating how these parameters should be structured:
"useDifferentBillingAddress": true,
"customerFullName": "Jacob Smith",
"emailAddress": "user@example.com",
"addr1": "Gotzkowskystraße 2332",
"city": "Delbrück",
"countryCode": "DE",
"postCode": "33129",
"phone": "12345678910"
Customizable Google Pay™ Button
To customize the Google Pay™ button within the request, include the googleButtonType
and googleButtonStyle
parameters in criteria
(see example above). The "type" parameter defines the text displayed on the button, such as a standard payment label or a subscription-related prompt, while "style" controls the button's visual theme to match different background and branding requirements. These parameters determine how the Google Pay™ button is generated on the page, ensuring flexibility in its presentation. By specifying these attributes, merchants can align the button's appearance with their checkout flow while maintaining compliance with Google's UI guidelines.
For more details, please refer to the Button Customization documentation.
Multiple Domains Support
To support multiple merchant domains for Google Pay™, merchants need to register them with Google, as only the domains added to Google Pay's whitelist will be valid for use. The registered domain automatically extends to its sub-directories as listed below, allowing Google Pay™ transactions on localized pages without requiring separate configurations.
your-shop.com
your-shop.com/de
your-shop.com/fr
Merchants must align with their Product Solution Specialist to ensure all relevant domains are configured within the backend program settings before initiating Google Pay™transactions. The domain should be provided without "https://", as the API handles secure connections internally.
Please refer to Google Pay™ Console - Registration of the shop domain for more information.
Initiate Authorization Response
Status Code:
200 (Created)
Header:
Content-Type: application/json
Accept-Language: en-US
{
"programAccno": "7228894817",
"accno": "7228905548",
"uniqueReference": "KR3aoEVFDMGggM6Jt77J8",
"loadAccountReference": "5coZ0ldKLpOIUO3r6mCKA",
"authorizationToken": "eyJjb25uZW***AwMjZ2PTQifQ==",
"paymentOptionCode": "GGLPAY",
"presentationAmount": 100,
"presentationCurrCode": "EUR",
"presentationUsage": "V Purchase:2xPremiumWidgets. Merchant:WidgetsGmbH. CUSTREF:52650FD95.",
"statusCode": "RECEIVED",
"statusReason": "Successful transaction request.",
"paymentProviderResponse": {
"result": {
"kcAuthorizationToken": "eyJjb25uZW***AwMjZ2PTQifQ==",
"providerRequestDetails": {
"processedData": {
"authorizationToken": "936e***e86ccf",
"transactionData": {
"reference": "KR3aoEVFDMGggM6Jt77J8",
"providerReference": "",
"amount": 100,
"currency": "EUR",
"country": "",
"status": "RECEIVED",
"statusReason": "Successful transaction request."
}
},
"providerResponse": [],
"responseCode": "0000",
"responseDescription": "Operation succeeded.",
"localTime": "2025-01-28T12:58:50+01:00"
}
},
"responseCode": "0000",
"responseDescription": "Operation succeeded.",
"localDateTime": "2025-01-28T12:58:50+01:00",
"additionalData": [
{
"name": "externalCalls",
"value": [
{
"url": "{baseURL}/api/v1/payment/initAuthorize",
"httpMethod": "POST",
"httpStatusCode": 200
}
]
}
]
},
"partnerReference": "eb9640b0-f731-4abf-8752-37e8280c9ee9",
"localDate": "2025-01-28",
"localTime": "125849",
"sysDate": "2025-01-28",
"sysTime": "115850",
"responseCode": "0000",
"responseDescription": "Successful execution.",
"additionalInformation": {
"requestId": "46226f393fc247ee9b6439507ce382da"
}
}
The response includes the desired authorization token under the return parameter "authorizationToken" which is used to collect payment option details via the SDK and alongside the "uniqueReference" is required to complete the authorization of the initiated transaction. The transaction reference under the return parameter "uniqueReference" is furthermore required for the following API calls. Beyond this use, it should be persisted if possible, as it enables the identification of the transaction should the need arise at a later stage.
Please use the "authorizationToken" from the root level of the response, as other instances within nested structures are for internal purposes and should not be used for further API calls.
2. Collect Payment Option Details via KC UPCF Web SDK
The KC UPCF Web SDK renders a customizable Google Pay™ button, which can be customized in the previous step, and transmits all necessary payment details to start the Google Pay™ Checkout flow. We offer SDKs for the integration into websites as well as mobile applications. Google Pay™ authentication requires Google Wallet™ app on Android.
The example below shows only the relevant part of the KC UPCF Web SDK implementation for Guest Payments with Google Pay™. A complete and detailed description of the KC UPCF Web SDK can be found here.
Example code to handle KC UPCF Web SDK for Google Pay™ button:
window.kc.webSdk.PaymentForm(container, {
authorizationToken,
callbackUrl: `${window.location.origin}${completedOrder}`,
paymentOptionCodes: ['GGLPAY'],
locale: "en-US",
paymentProviderMode: "test",
submitButtonTitle: "buy",
onError: function (message) {
// handle errors
},
onComplete: function () {
// handle google authorization
}
})
The authorization token returned by the API method 1.38 Init Authorize which initiated the transaction is used to associate the payment option details collected via the KC UPCF Web SDK with the transaction.