simplepay-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

SimplePay SDK

SimplePay SDK is a comprehensive JavaScript/TypeScript library for integrating with the SimplePay gateway — a fully decentralized, open-source cryptocurrency processing platform. Designed to facilitate seamless interactions with blockchain networks, the SDK supports both Ethereum Virtual Machine (EVM) compatible chains and non-EVM blockchains such as Bitcoin and Litecoin. This makes it a versatile tool for developers looking to implement crypto payments into their applications.

Features

  • Decentralized Payments: Interact directly with blockchain networks for secure, trustless transactions.
  • Multi-Blockchain Support: Work with EVM and non-EVM blockchains including Ethereum, Bitcoin, and Litecoin.
  • Invoice Management: Easily issue and read invoices through smart contracts.
  • Real time Event Listening: Subscribe to smart contract events for real-time notifications.
  • Token Information: Fetch detailed token data from supported networks via our SimplePay Rates API.

Installation

You can install the SimplePay SDK using npm or yarn:

npm install simplepay-sdk
# or
yarn add simplepay-sdk

Quick Start

To begin using the SDK, you'll need to set up your environment with access keys from https://s-auth.org. Here's a quick example to issue an invoice:

import SimplePay from 'simplepay-sdk';

const sp = new SimplePay({
  projectSecret: process.env.PROJECT_SECRET,
  public_key: process.env.PUBLIC_KEY,
  secret_key: process.env.SECRET_KEY,
  projectId: process.env.PROJECT_ID,
  providerUrl: "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID",
});

const invoiceRequest = {
  tokenId: 1, // Token ID for Bitcoin
  productId: 'your-product-id',
  price: 100, // Price in USD
  from: '0xFromWalletAddress',
  to: '0xToWalletAddress',
  clientEmail: 'customer@example.com'
};

async function createInvoice() {
  try {
    const invoiceId = await sp.issueInvoice(invoiceRequest);
    console.log(`Invoice created with ID: ${invoiceId}`);
  } catch (error) {
    console.error('Failed to issue invoice:', error.message);
  }
}

createInvoice();

Documentation

For more detailed information on all available classes, methods, and their parameters, please refer to our API documentation.

License

SimplePay SDK is open-source software licensed under the MIT License.

Package Sidebar

Install

npm i simplepay-sdk

Homepage

s-auth.org

Weekly Downloads

5

Version

1.0.9

License

MIT

Unpacked Size

67.9 kB

Total Files

14

Last publish

Collaborators

  • simpletechnologies