0.18.0 • Published 19 days ago

@gatefi/js-sdk v0.18.0

Weekly downloads
-
License
-
Repository
-
Last release
19 days ago

Unlimit Crypto JS SDK

Full documentation

Get started

Unlimit Crypto can be integrated in a variety of ways. The supported integration modes make it possible to find the configuration that is most suitable for your project.

$ yarn add @gatefi/js-sdk

or

$ npm install @gatefi/js-sdk

Once the npm package is installed, you need to configure the constructor of our SDK. For the overlay mode, the simplest configuration will look as follows:

var instance = new gateFiSDK.GateFiSDK({
    merchantId: "testID",
    displayMode: "embedded",
    nodeSelector: "#container",
})

SDK Configuration Options

The Unlimit Crypto widget provides multiple customization options that can be used to modify the look of the payment form. The following configuration parameters are available:

PARAMETERTYPEREQUIREDDESCRIPTION
merchantIdStringYID of the user account.
displayModeStringYSpecifies the display mode. Possible options:- embedded- overlay
nodeSelectorStringYDefines the .CSS selector related to the HTML element, where you want to integrate the widget.
externalIdStringCustom ID of the order.
walletAddressStringPre-populates the wallet address, to which the purchased cryptocurrency will be sent.
emailStringPre-populates the user's e-mail address.
hideThemeSwitcherBooleanAllows to hide the theme switcher in the widget.
defaultFiatObjectAn object that sets the default fiat currency type and amount.
currencyStringSets the default fiat currency type.
amountStringSets the default fiat currency amount.
defaultCryptoObjectAn object that sets the default cryptocurrency type and amount.
currencyStringSets the default cryptocurrency type.
amountStringSets the default cryptocurrency amount.
availableCryptoArray (string)Defines a list of available cryptocurrencies.
availableFiatArray (string)Defines a list of available fiat currencies.
stylesObjectAn object that customizes the look of the widget.
typeStringSpecifies the theme for which you want to customize the look of the widget. Possible options:- dark- light
primaryBackgroundStringSpecifies the background color.
secondaryBackgroundStringSpecifies an additional background color.
primaryColorStringSpecifies the main color for the widget elements (text, buttons, hyperlinks, etc.).
secondaryColorStringSpecifies an additional color for the main elements (text, buttons, hyperlinks, etc.).
primaryTextColorStringSpecifies an additional color for text elements (label inside primary button)
isSandboxBooleanDefines if the widget is used in the sandbox mode.
walletLockBooleanBlocks the ability to change the crypto wallet address.
fiatAmountLockBooleanBlocks the ability to change the amount for fiat currency.
cryptoAmountLockBooleanBlocks the ability to change the amount for cryptocurrency.
fiatCurrencyLockBooleanBlocks the ability to select a fiat currency.
cryptoCurrencyLockBooleanBlocks the ability to select a cryptocurrency.
hideAssetBooleanHide the cryptocurrency field.
hideThemeSwitcherBooleanDefines if the theme switcher link should be hidden.
successUrlStringDefines the URL for redirection after the payment is successful.
cancelUrlStringDefines the URL for redirection after the payment is cancelled.
declineUrlStringDefines the URL for redirection after the payment is declined.
inprocessUrlStringDefines the redirect URL for in process status of payment.
availablePaymentsArray (string)Lists the available payment method codes.
paymentStringSets the payment method code for the order.
regionStringPre-sets the user's region. Can be a country ID (for example: US) or state ID (for example: US-AL).
langStringSpecifies the language of the widget. Possible options:- GateFiLangEnum.es_PE (Spanish)- GateFiLangEnum.en_US (English)- GateFiLangEnum.pt_BR (Portuguese)
redirectUrlStringRedirects the user to this url after the purchase has been performed and the user has clicked "Back to Shop" button in the platform widget. For example: https://google.com
customTextsObjectAn object with custom texts.
backToButtonLabelStringCustom text for manual redirect button. Default text: Back to Shop

Events

Using the .subscribe() и .unsubscribe() methods provided in the Unlimit Crypto SDK, the merchant can subscribe/unsubscribe to the widget-related events. It is possible to subscribe to the following events:

  • onLoad - the widget is loaded and ready to work (after that, the configuration is sent to the widget).
  • onClose - the widget was closed by the customer (after that, the widget dialog is closed). This event is relevant only for the overlay mode.

Below is an example of subscription to widget-related events:

var instance = new gateFiSDK.GateFiSDK({
  merchantId: "testID",
  displayMode: "overlay",
  nodeSelector: "container"
})

instance.subscribe(GateFiEventTypes.onClose, (type, payload) => {
   console.log(type, payload)
})

Callbacks

Using a variety of methods provided in the Unlimit Crypto SDK, the merchant can manipulate the widget. The following actions are available:

  • hide() - closes the widget dialog (this method is relevant only for the overlay mode).
  • setThemeType(type: "dark" | "light") - sets the theme for the widget.
  • show() - displays the widget dialog (this method is relevant only for the overlay mode).
  • destroy() - removes the instance of the widget (deletes the widget from DOM).
0.18.0

19 days ago

0.18.0-prod

19 days ago

0.17.0

3 months ago

0.15.1

4 months ago

0.13.0

8 months ago

0.14.0

6 months ago

0.13.1

7 months ago

0.12.2

10 months ago

0.15.0

5 months ago

0.13.2

7 months ago

0.11.0

11 months ago

0.10.0

11 months ago

0.7.1

12 months ago

0.7.0

1 year ago

0.5.0

1 year ago

0.3.2

1 year ago

0.3.3

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.0

1 year ago

0.2.0-sandbox

1 year ago

1.1.0

1 year ago

1.1.0-prod-1

1 year ago

1.1.0-sandbox

1 year ago

1.1.0-prod

1 year ago

0.1.16

1 year ago

0.1.15

1 year ago

0.1.14

1 year ago

0.1.10

1 year ago