Skip to main content

Web

Introduction​

The Software Development Kit for Web is a client-side JavaScript library with a simple set of tools that allow you to easily communicate with the Paysafe Wallet API. The SDK is written in TypeScript and exposes a set of type declaration files, which can be used in order to ease your type checking.

By using the SDK, you can take advantage of pre-built features such as:

  • Automatic SDK setup
  • Automatic token management
  • Built-in services for performing HTTP API calls to the Paysafe Wallet API
  • Others

Requirements​

The SDK uses the Fetch API for performing HTTP requests in both node and the browser. This would require:

  • Node 18.0.0 or higher
  • Modern browser version with Fetch API support

Main concepts​

Client-side​

The SDK is designed to be used in a client-side environment, such as a web browser. This is an essential part of the automated SDK setup, as it enables the SDK to properly gather and manage the necessary configurations for a better developer and user experience.

Promise-based​

The SDK is promise-based and all API operations return a promise. This allows you to easily chain operations, handle both success and error cases and implement the flow that best suits your needs.

Wallet​

All SDK features are exposed through the Wallet object. The Wallet object is responsible for the SDK setup and all services and API operations are accessible through it.

Wallet Operations​

The SDK provides a set of services that are used for performing HTTP requests to the Paysafe Wallet API. Each of those services are responsible for different flows, such as user management, transactions, deposits, etc.

Error handling​

The SDK provides a unified approach to handling errors by returning a WalletError object as a response whenever an error is returned by the Paysafe Wallet API.