Top-up by Google Pay

Top-up by Google Pay allows your customers to top-up IBAN opened at ConnectPay by Google Pay’s digital wallet.

Stage:

Production:

To receive this service, you will need to have BaaS contract – just inform your account manager about it, as top up is disabled by default.

Prerequisite:

Google Pay top-up payments are settled instantly, you don’t need to wait as it is for commercial transactions.

Flow:

Integration can be split in two parts – wallet validation together with payment sheet creation and payment initiation.

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

const paymentsClient =
    new google.payments.api.PaymentsClient({{
  environment: "TEST",
  merchantInfo: {
    merchantName: "Example Merchant",
    merchantId: "12345678901234567890"
  },});

Tip! Google recommends only initialize paymentsClient once. Use the same instance when you invoke all of the other APIs, like CreateButton, IsReadyToPay, PrefetchPaymentData, and LoadPaymentData.

const baseRequest = {
    apiVersion: 2,
    apiVersionMinor: 0,
  };
const allowedCardNetworks = ['MASTERCARD', 'VISA'];
const allowedCardAuthMethods = ['PAN_ONLY','CRYPTOGRAM_3DS'];
const baseCardPaymentMethod = {
    type: 'CARD',
    parameters: {
      allowedAuthMethods: allowedCardAuthMethods,
      allowedCardNetworks: allowedCardNetworks,
      assuranceDetailsRequired: true,
    },
    tokenizationSpecification: {
    type: PAYMENT_GATEWAY,
    parameters: {
      gateway: example,
      gatewayMerchantId: exampleGatewayMerchantId
    }
    }
  };

const isReadyToPayRequest = Object.assign({}, baseRequest);isReadyToPayRequest.allowedPaymentMethods = [baseCardPaymentMethod];

paymentsClient.isReadyToPay(isReadyToPayRequest)
    .then(function(response) {
      if (response.result) {
        // add a Google Pay payment button
      }
    })
    .catch(function(err) {
      // show error in developer console for debugging
      console.error(err);
    });

  1. Then PaymentDataRequest should be created. To create a PaymentDataRequest object, complete the following steps:
const paymentDataRequest = Object.assign({}, baseRequest);

  • Add the payment methods supported by your app, such as any configuration of additional data that’s expected in the response. See the following code sample:
paymentDataRequest.allowedPaymentMethods = [cardPaymentMethod];

  • Define a total price and currency for a shopper to authorize. You must include the countryCode, totalPrice, and merchantName parameters to meet SCA requirements. See the following code sample:
paymentDataRequest.transactionInfo = {
  totalPriceStatus: 'FINAL',
  totalPrice: '123.45',
  currencyCode: 'EUR',
  countryCode: 'LT'
};

  • Provide a user-visible merchant name, and use Google TEST merchantId value when in TEST environment. See the following code sample of a user-visible merchant name:
paymentDataRequest.merchantInfo = {
  merchantName: 'Example Merchant'
  merchantId: '12345678901234567890'
};

  1. Then payment sheet initialization should start. To register an event handler for user gestures, complete the following steps:
  • Register a click event handler for the purchase button. The event handler calls loadPaymentData() immediately after it interacts with the Google Pay, payment button.
  • After a Google user grants permission for your site to receive information about the user’s selected form of payment and optional contact data, handle the response from the Google Pay API.

Note! In a TEST environment, a payment response includes summary data about the selected payment method that’s suitable for display on a confirmation page. The payment response doesn’t include a payment method that’s capable of a transaction.

paymentsClient.loadPaymentData(paymentDataRequest).then(function(paymentData){
  // if using gateway tokenization, pass this token without modification
  paymentToken = paymentData.paymentMethodData.tokenizationData.token;
}).catch(function(err){
  // show error in developer console for debugging
  console.error(err);
});

Top-up payments

Top-up by PIS

Payment details

Notifications

Scroll to Top