HomeGuidesRecipesAPI ReferenceChangelog
Log In
Guides
These docs are for v2.1.2. Click to read the latest docs for v2.2.0.

Javascript

GetUnblock SDK is a JS library for interacting with Unblock APIs

🚧

The SDK is not up to date with the v2.0.0

The SDK is being updated to the new API standard 2.0.0, it is not yet live. For any new implementation please use the API directly.

Installation

npm i @getunblock/sdk

Usage

Typescript

import getunblockSDK, { Currency } from "@getunblock/sdk";

(async () => {
  // setup SDK
  const sdk = getunblockSDK({
    apiKey:
      "API-Key [Some merchant Key]", // Key generated at the moment the merchant was created in getunblock system
    prod: false, // If true Production environment will be used otherwise Sandbox will be used instead
  });
  
  // SDK API call example
  const result = await sdk.exchangeRates.getExchangeRate({
    baseCurrency: Currency.USD,
    targetCurrency: Currency.EURO,
  });

  console.log(result);
})();

JavaScript

const getunblockSDK = require("@getunblock/sdk").default;
const { Currency } = require("@getunblock/sdk");

(async () => {
  // setup SDK
  const sdk = getunblockSDK({
    apiKey:
      "API-Key [Some merchant Key]", // Key generated at the moment the merchant was created in getunblock system
    prod: false, // If true Production environment will be used otherwise Sandbox will be used instead
  });
  
  // SDK API call example
  const result = await sdk.exchangeRates.getExchangeRate({
    baseCurrency: Currency.USD,
    targetCurrency: Currency.EURO,
  });

  console.log(result);
})();