Install the SDK

Getting Started

This guide explains how to get started with the SuiPay TypeScript SDK for accepting cryptocurrency payments and managing withdrawals.

Installation

Install the SuiPay SDK using npm or yarn:

npm install @suipay/api
# or
yarn add @suipay/api

Requirements

  • Node.js 16.0.0 or higher

  • TypeScript 4.5 or higher (for TypeScript projects)

Quick Start

1. Get Your API Key

Before using the SDK, you'll need an API key from the SuiPay dashboard:

  1. Login to SuiPay: Visit https://demo2.suipay.net and sign in to your account

  2. Navigate to Dev API Keys: Go to the "Dev API Keys" section in your dashboard

  3. Create New API Key: Click the "Create API Key" button

  4. Name Your Key: Give your API key a descriptive name (e.g., "Production API", "Development Testing")

  5. Save the Key: Your API key will be displayed once. Copy and store it securely - you won't be able to see it again!

Important: API keys start with sk_ and should be kept secure. Never share them publicly or commit them to version control.

Your API key will look like this:

API Key Security Best Practices:

  • Store API keys as environment variables

  • Never commit API keys to version control

  • Rotate API keys regularly

  • Delete unused API keys from your dashboard

2. Initialize the Client

Import and initialize the SuiPay client:

3. Test Your Connection

Verify your API key and connection:

4. Get User Information

Retrieve your user information and current balance:

Create a payment link that customers can use to pay you:

Environment Configuration

You can configure the SDK using environment variables:

Then use in your code:

Error Handling

The SDK provides specific error types for different scenarios:

Rate Limits

The SuiPay API has the following rate limits:

  • General API endpoints: 300 requests per minute

  • Authentication endpoints: 5 requests per minute

The SDK will automatically throw a SuiPayRateLimitError when rate limits are exceeded.

Next Steps

  • Learn more about authentication configuration

  • Understand how to work with users and their data

  • Create and manage payment links

  • Implement withdrawal functionality

  • Handle errors properly

Last updated