Skip to content

Repository files navigation

Solidgate Client SDK Loader

This repository is wrapper for the Solidgate Client Software Development Kit (SDK).

It supports rendering payment forms and resign forms, including custom container elements for Google Pay, Apple Pay, PayPal, or Click to Pay buttons.

Check our

Structure

SDK contains Table of contents
src - source code
.husky - pre-commit hooks
package.json – project metadata and dependency definitions
Installation
Usage
Development

Installation

npm install --save @solidgate/client-sdk-loader

Usage

import { SDKLoader } from "@solidgate/client-sdk-loader"

/**
 * Configuration, as it described here
 * https://docs.solidgate.com/payments/integrate/payment-form/create-your-payment-form/
 */
const data = {
  merchantData: {
    merchant: '<<--YOUR MERCHANT ID-->>',
    signature: '<<--YOUR SIGNATURE OF THE REQUEST-->>',
    paymentIntent: '<<--YOUR PAYMENT INTENT-->>'
  }
}

async function init() {
  const sdk = await SDKLoader.load()
  const form = sdk.init(data)
}

Wallet card type

Apple Pay and Google Pay report the payer's card funding type before the charge. Subscribe to walletCardType to inspect it and, optionally, pause the wallet flow with pauseUntil while you call an update intent method (update, updateCheckout). The side effect has a 25 s budget, measured from the moment the event fired:

form.on('walletCardType', (event, pauseUntil) => {
  const { wallet, card } = event.data // wallet: 'applePay' | 'googlePay'

  if (card.type === 'unknown') {
    return // no intent update - the wallet continues immediately
  }

  pauseUntil(async () => {
    await form.update({ partialIntent: intentFor(card.type) })
  })
})

Calling an update intent method inside the event on Google Pay also requires googlePayButtonParams: { totalPriceStatus: 'TOTAL_PRICE_STATUS_ESTIMATED' } in the init config, so the sheet renders the amount as an estimate.

Development

Build:

npm run build

Test

npm run test

About

Wrapper for consistently loading payment form client SDK

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages