@solidgate/client-sdk-loader
v1.37.0
Published
Solidgate client sdk loader
Readme
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
- Payment guide to understand business value better
- API Reference to find more examples of usage
Structure
Installation
npm install --save @solidgate/client-sdk-loaderUsage
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 buildTest
npm run test