Integration

To be able to render the Google Pay™ button on your website you need to follow the steps below.

  1. Inject the Buckaroo SDK

Buckaroo's ClientSide SDK works as a wrapper for Google's API. Inject the following script in your page:

<script src="https://checkout.buckaroo.nl/api/buckaroosdk/script" />
  1. Initialize the Google Pay Button

To initialize the Google Pay button you have to create a new GooglePayPayment object by passing the options described below:

FieldRequiredDescription
EnvironmentYesAvailable values are 'PRODUCTION' or 'TEST'. If not provided it will default to 'TEST'.
For more information see Google Pay Documentation page.
AllowedCardNetworksNoFor now available brands are 'VISA' and 'Mastercard'. If not provided it will default to all available card brands.
AllowedCardAuthMethodsNoSee Google Pay Documentation here. If not provided it will default to all available values.
ButtonColorNoSee Google Pay Documentation. If not provided it will default to all available values.
ButtonTypeNoSee Google Pay Documentation. If not provided it will default to all available values.
ButtonRadiusNoSee Google Pay Documentation. If not provided it will default to all available values.
ButtonLocaleNoSee Google Pay Documentation. If not provided it will default to all available values.
ButtonContainerIdYesThe ID of the HTML element you want to append the button to. If not provided it will default to the container id 'google-pay-button-container'.
TotalPriceStatusYes

The status of the total price used:

ESTIMATED — total price might adjust based on the details of the response (e.g., sales tax).

FINAL — total price doesn't change from the amount presented to the shopper. For more information see Google Pay Documentation.

TotalPriceYesTotal monetary value of the transaction with an optional decimal precision of two decimal places. For more information see Google Pay Documentation.
CurrencyCodeYesThe ISO 4217 alphabetic currency code. For more information see Google Pay Documentation.
CountryCodeYesThe ISO 3166-1 alpha-2 country code where the transaction is processed. Required for EEA countries. For more information see Google Pay Documentation.
MerchantNameYesMerchant name encoded as UTF-8. Merchant name is rendered in the payment sheet. For more information see Google Pay Documentation.
MerchantIdYesA Google merchant identifier issued after registration with the Google Pay & Wallet Console. The merchant ID can have 12–18 characters. For more information see Google Pay Documentation.
MerchantOriginNoThe fully qualified domain of the merchant who made the request. Ignore this if you are using the Direct Integration.
GatewayMerchantIdYesThe merchant unique ID provided by Buckaroo after onboarding. For more information see Google Pay Documentation.
OnGooglePayLoadError()YesCallback function that is triggered when the Google PaymentsClient fails to initialize or the Google Pay button cannot be added properly.
ProcessPayment()YesCallback function that handles the processing of the payment. Once the token is retrieved you can send it for further processing towards our Checkout as explained in the next point below.
ShippingAddressRequiredNoSet to true to request a full shipping address. For more information see Google Pay Documentation.
ShippingAddressParametersNoIf shippingAddressRequired is set to true, specify shipping address restrictions. For more information see Google Pay Documentation.
ShippingOptionRequiredNoSet to true when the SHIPPING_OPTION callback intent is used. This field is required if you implement support for Authorize Payments or Dynamic Price Updates. For more information see Google Pay Documentation.
ShippingOptionParametersNoSet default options. For more information see Google Pay Documentation.

Once you have created the GooglePayPayment object then you need to call the initiate() function. Below is a demo of initializing the Google Pay Button:

function initGooglePayButton() {
    const googlePayPayment = new BuckarooSdk.GooglePay.GooglePayPayment({
        environment: 'TEST',
        buttonRadius: 7,
        buttonSizeMode: 'fill',
        buttonContainerId: 'google-pay-button-container',
        totalPriceStatus: 'FINAL',
        totalPrice: '0.1',
        currencyCode: 'EUR',
        countryCode: 'NL',
        merchantName: 'Example Merchant',
        merchantId: '01234567890123456789',
        gatewayMerchantId: 'exampleGatewayMerchantId',
        onGooglePayLoadError: (error) => {
            console.error('Error loading GooglePay script:', error);
        },
        processPayment: (paymentData) => {
                // Process Payment Callback logic
        },
    });
    
    googlePayPayment.initiate();
}