npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bleumi/pay-sdk

v1.0.8

Published

NodeJS SDK for Bleumi Pay API

Downloads

474

Readme

Bleumi Pay SDK for NodeJS

GitHub license

The Bleumi Pay SDK helps you integrate Algo, Algorand Standard Asset, Ethereum, ERC-20, RSK, RSK ERC-20 & xDai payments and payouts into your business or application. The SDK bundles Bleumi Pay API into one SDK to ease implementation and support.

bleumi-pay-sdk-nodejs is a TypeScrpit-NodeJS library that provides an interface between your NodeJS application and Bleumi Pay API. This tutorial covers the basics, including examples, needed to use the SDK.

Getting Started

The Bleumi Pay SDK for NodeJS bundles TypeScript definition files for use in TypeScript projects and to support tools that can read .d.ts files. Our goal is to keep these TypeScript definition files updated with each release for any public api.

Pre-requisites

Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets a few of these requirements:

Development Environment

  • Use TypeScript v2.x

  • Includes the TypeScript definitions for node. You can use npm to install this by typing the following into a terminal window:

    npm install --save-dev @types/node
  • If you are targeting at es5 or older ECMA standards, your tsconfig.json has to include 'es5' and 'es2015.promise' under compilerOptions.lib. See tsconfig.json for an example.

Obtain An API Key

Bleumi Pay SDK uses API keys to authenticate requests. You can obtain an API key through the Bleumi Pay Dashboard.

Install Package

npm (scoped)

In Node.js

npm install @bleumi/pay-sdk -g

Run Sample Code

The following code generates an unique checkout URL to accept payment from the buyer:


import { HostedCheckoutsApi, HostedCheckoutsApiApiKeys, CreateCheckoutUrlRequest } from '@bleumi/pay-sdk';

// Instantiate client
const bleumiPay = new HostedCheckoutsApi();

async function createCheckoutUrl(id: string) {
    try {
        bleumiPay.setApiKey(HostedCheckoutsApiApiKeys.ApiKeyAuth, '<YOUR_API_KEY>'); //Replace <YOUR_API_KEY> with your actual API key

        const chain = Chain.Goerli;
        const createCheckoutUrlRequest = new CreateCheckoutUrlRequest();

        createCheckoutUrlRequest.id = id
        createCheckoutUrlRequest.currency = "<CURRENCY>"
        createCheckoutUrlRequest.amount = "<AMOUNT>"
        createCheckoutUrlRequest.cancelUrl = "<CANCEL_URL>" // Eg. https://demo.store/api/cancelOrder
        createCheckoutUrlRequest.successUrl = "<SUCCESS_URL>" // Eg. https://demo.store/api/completeOrder
        createCheckoutUrlRequest.token = '<TOKEN>'; // string | Replace <TOKEN>  by anyone of the following values: 'ETH' or 'XDAI' or 'XDAIT' or ECR-20 Contract Address or 'RBTC' or RSK ECR-20 Contract Address or 'Asset ID' of Algorand Standard Asset. | Optional

        createCheckoutUrlRequest.chain = chain;

        const response = await bleumiPay.createCheckoutUrl(createCheckoutUrlRequest);
        const createCheckoutUrlResponse = response.body;
        console.log(JSON.stringify(createCheckoutUrlResponse));
    } catch (err) {
        if (err.response) {
            console.error('Error statusCode:', err.response.statusCode);
            console.error('Error reponse:', err.response.body);
        } 
        console.log('Error message:',err.message);
    }
}

More examples can be found under each method in SDK Classes section.

SDK Classes

Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- HostedCheckoutsApi | createCheckoutUrl | POST /v1/payment/hc | Generate a unique checkout URL to accept payment. HostedCheckoutsApi | listTokens | GET /v1/payment/hc/tokens | Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard. HostedCheckoutsApi | validateCheckoutPayment | POST /v1/payment/hc/validate | Validate the GET parameters passed by Hosted Checkout in successUrl upon successfully completing payment. PaymentsApi | getPayment | GET /v1/payment/{id} | Retrieve the wallet addresses & token balances for a given payment PaymentsApi | listPayments | GET /v1/payment | Retrieve all payments created. PaymentsApi | settlePayment | POST /v1/payment/{id}/settle | Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress PaymentsApi | refundPayment | POST /v1/payment/{id}/refund | Refund the balance of a token for a given payment to the buyerAddress PaymentsApi | getPaymentOperation | GET /v1/payment/{id}/operation/{txid} | Retrieve a payment operation for a specific payment. PaymentsApi | listPaymentOperations | GET /v1/payment/{id}/operation | Retrieve all payment operations for a specific payment. PayoutsApi | createPayout | POST /v1/payout | Create a payout. PayoutsApi | listPayouts | GET /v1/payout | Returns a list of payouts

Documentation For Models

Limitations

License

Copyright 2020 Bleumi, Inc.

Code licensed under the MIT License.