SimpleTech Labs
WebsiteConsoleAPITwitterTelegram ChannelTelagram Chat
SimplePay
SimplePay
  • Introduction
    • Overview
    • Core concepts
      • Transparency
      • Non-Custodial
      • Direct payments
      • Lowest Fees
    • Protocol
    • Security
      • Collected data
  • GETTING STARTED
    • Create an App
    • Setup Client
      • Widget
    • Setup Server
      • Webhooks
    • No-Code
      • Web and Telegram Store
  • Javascript SDK
    • Introduction
    • Services
      • Cryptocurrency
      • Currency
      • Invoice
  • Components
    • Payment Widget
  • Simple ID
    • Auth.js integration Guide
  • API Documentation
    • Overview
    • Apps
      • Get App Info
      • Dev Mode
    • Wallets
    • Assets
      • Fiat Currency
      • Cryptocurrency
    • Products
    • Invoices
      • Methods
    • Transactions
      • Page 1
    • Billing
  • Referral Program
    • 💰Referral Program Basics
  • Legal
    • 📄Terms of Use
    • 🔏Privacy Policy
    • 🍪Cookies
Powered by GitBook
On this page
  • Entities
  • Cryptocurrency
  • Network
  • CryptocurrencyRates
  • Methods
  • List cryptocurrencies

Was this helpful?

  1. Javascript SDK
  2. Services

Cryptocurrency

Cryptocurrency API allows merchants to get some information about cryptocurrencies, that may be used during invoice creation

Entities

Cryptocurrency

Cryptocurrency entity represents single cryptocurrency

Type may be imported as:

import type { Cryptocurrency } from '@simplepay-ai/api-client';

Type definition:

interface Cryptocurrency {
    /**
     * Cryptocurrency ID
     *
     * @example '4967cf90-ce74-4edf-9b4e-f6392de1c95a'
     */
    id: string;

    /**
     * Cryptocurrency symbol
     *
     * @example 'USDT'
     */
    symbol: string;

    /**
     * Cryptocurrency name
     *
     * @example 'Tether'
     */
    name: string;

    /**
     * Number of decimal places
     *
     * @example 18
     */
    decimals: number;

    /**
     * Is stablecoin
     *
     * @example true
     */
    stable: boolean;

    /**
     * List of blockchains in which cryptocurrency may be accepted
     */
    networks?: Network[];

    /**
     * Conversion rates to fiat currencies
     *
     * Key is ISO 4217 alphabetic code of fiat currency
     *
     * Value is price for 1 coin
     *
     * @example {
     *   USD: 1,
     *   EUR: 0.98
     * }
     * @see https://en.wikipedia.org/wiki/ISO_4217
     */
    rates?: CryptocurrencyRates;
}

Network

Network entity represents single blockchain network

Type may be imported as:

import type { Network } from '@simplepay-ai/api-client';

Type definition:

interface Network {
    /**
     * Network ID
     *
     * @example '7639e9e4-6306-46a9-9acc-cc943d0d0c60'
     */
    id: string;

    /**
     * Network symbol
     *
     * @example 'ethereum'
     */
    symbol: string;

    /**
     * Network name
     *
     * @example 'Ethereum'
     */
    name: string;

    /**
     * Network type
     *
     * @example 'EVM'
     */
    type: string;
}

CryptocurrencyRates

CryptocurrencyRates entity is an object with conversion rates to fiat currencies

Value is price for 1 coin

Type may be imported as:

import type { CryptocurrencyRates } from '@simplepay-ai/api-client';

Type definition:

interface CryptocurrencyRates {
    [key: string]: number;
}

Methods

List cryptocurrencies

Request type definition:

type CryptocurrencyListRequest = {
    /**
     * Return cryptocurrencies for specific App ID
     *
     * @example 'db50e5fc-1b91-49c4-8b6a-d33a44ffdda5'
     */
    appId?: string;

    /**
     * Include cryptocurrency rates in response
     *
     * @default false
     */
    rates?: boolean;

    /**
     * Include networks list in response
     *
     * @default false
     */
    networks?: boolean;
};

Validation errors type definition:

export type CryptocurrencyListErrors = {
    appId?: 'uuid4';
    rates?: 'boolean';
    networks?: 'boolean';
};

Method call example:

import type { CryptocurrencyListRequest, HttpError } from '@simplepay-ai/api-client';

try {
    const request: CryptocurrencyListRequest = {
        // Request is optional and may be omitted
    };

    const cryptocurrencies = await api.cryptocurrency.list(request);

    console.debug(cryptocurrencies);
} catch (e) {
    if (e instanceof HttpError) {
        const error = e as HttpError;

        console.error(error.code);
    }
}
PreviousServicesNextCurrency

Last updated 8 months ago

Was this helpful?

Key is alphabetic code of fiat currency

If you require cryptocurrency that is not in list, we will be glad to help you, feel free to

ISO 4217
Request Cryptocurrency