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

@alixpay/alix-nodejs-sdk

v1.0.1

Published

Alixplay sdk for nodejs

Downloads

7

Readme

AliXPay official js SDK

Table of Contents

General info

The AliXPay SDK is a plug and play ready to go implementation to access our services.
It allows for a simple and fast integration.

Installation

Install the package via npm

npm i @alixpay/alix-nodejs-sdk 

Authentication

Public key and ApiSecret

While on-boarding with aliXpay, you will be provided with information,
initially these will be for the sandbox environment. Once you are done testing the implementation, you will receive the credentials to use the production environment.

Usage

AlixPay.create(code, apiSecret, language, env)

| Property | type | required | description | |--------------|----------|----------|---------------------------------------------------------------------| | code | string | true | partner code | | apiSecret | string | true | Given API Secret | | language | string | true | Given API language | | env | string | Staging | Staging | Production Enable if testing, and provide sandbox api key and secret to method |

Sandbox
const code = 'partner';
const sandboxApiSecret = 'xxxx-xxxx-xxxx-xxxx';
const language = 'en'
const env = 'Staging';
AlixPay.create(code, sandboxApiSecret, language, env)
Production
const code = 'partner';
const apiSecret = 'xxxx-xxxx-xxxx-xxxx';
const language = 'en'
const env = 'Production';
AlixPay.create(code, apiSecret, language, env)

Verify Account

Allows the partner verify the account

verify

alixPay.verifyAccount(partnerCode, signature);

| Property | description | required | description | |:-----------|:------------|:---------|:-----------------------------------| | partnerCode | string | true | partnerCode provided by AliXPay | | signature | string | true |The data shall be signed according partnerCode|secretKey |

Result Example

{
  "name": "string",
  "email": "string",
  "status": "string",
  "signature": "string"
}

Verify Bank Account

Allows the partner verify the bank account

verify

alixPay.verifyAccount(partnerCode, bankCode, bankAccountNumber, signature);

| Property | description | required | description | |:-----------|:------------|:---------|:-----------------------------------| | partnerCode | string | true | partnerCode provided by AliXPay | | signature | string | true |The data shall be signed according partnerCode|bankCode|bankAccountNumber|secretKey |

Result Example

{
  "bankCode": "string",
  "bankAccountNumber": "string",
  "bankAccountName": "string",
  "signature": "string"
}

Get Account Balance

Allows the partner get the current account balance

verify

alixPay.verifyAccount(partnerCode, currency, signature);

| Property | description | required | description | |:-----------|:------------|:---------|:-----------------------------------| | partnerCode | string | true | partnerCode provided by AliXPay | | signature | string | true |The data shall be signed according partnerCode|currency|secretKey |

Result Example

{
  "balance": 0,
  "currency": "string",
  "signature": "string"
}

Get Prices

Allows the partner get the current price of currencies

verify

alixPay.getPrices(partnerCode, currencies, network, signature);

| Property | description | required | description | |:-----------|:------------|:---------|:-----------------------------------| | partnerCode | string | true | partnerCode provided by AliXPay | | signature | string | true |The data shall be signed according partnerCode|currencies|network|secretKey |

Result Example

{
  "network": "string",
  "currencies": [
    {
      "name": "string",
      "price": 0
    }
  ],
  "signature": "string"
}

Fetch order

Fetch single order

alixPay.getOrder(orderId);

| Property | description | required | description | |:-----------|:------------|:---------|:-----------------------------------| | partnerCode | string | true | partnerCode provided by AliXPay | | externalOrderId | string | true | Unique ID of the order to retrieve | | signature | string | true |The data shall be signed according partnerCode|externalOrderId|secretKey |

Result Example

{
  "externalOrderId": "string",
  "type": "string",
  "fiatAmount": 0,
  "paidAmount": 0,
  "tokenTransfer": {
    "currency": "string",
    "network": "string",
    "price": 0,
    "amount": 0,
    "address": "string",
    "txHash": "string"
  },
  "bankTransfer": {
    "bankAccountName": "string",
    "bankAccountNumber": "string",
    "bankName": "string",
    "contentPayment": "string",
    "totalPayment": 0,
    "qrUrl": "string"
  },
  "fees": {
    "systemFee": 0,
    "processingFee": 0
  },
  "status": "string",
  "descriptions": "string",
  "createdAt": "string",
  "expiresAt": "string",
  "signature": "string"
}

Creating orders

Allows your customer to create a buy or sell crypto order with AliXPay. Upon success, the response will contain a checkout URL which will be unique for the order. The customer will be redirected to this URL to complete the checkout process, which will expire after 1 minute if a redirect does not occur.

When creating an order you will be required to create a BuyOrderTransaction/SellOrderTransaction/NftBuyOrderTransaction object. This object will allow you to create a transaction using a coin amount, or if you require both, you can specify your own amount using the createDynamic method, this will depend on your business use case.

Creating a buy order

alixPay.createBuyOrder(
  buyOrderTransaction,
  webhookSecretKey,
);

| Property | type | required | description | |-------------------------|---------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | buyOrderTransaction | Object | true | BuyOrderTransaction object | | webhookSecretKey | string ` | The secret key has created and managed by partner

BuyOrderTransaction using Coin as base amount

 const buyOrderTransaction = BuyOrderTransaction.createFromCoinAmount(
      partnerCode, 
      externalOrderId, 
      currency, 
      coinAmount, 
      network,
      walletAddress, 
      paymentMethod,
      signature
  );

| Property | type | required | description | |---------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------| | partnerCode | string | true | The customer's unique ID | | externalOrderId | string | true | Your transaction id as Unique Id | | currency | string | true | Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto | | coinAmount | string/number | true | The coin amount | | network | string | true | Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto
| walletAddress | string | true | The target wallet address to transfer the coin to | | paymentMethod | string/number/undefined | false | Unique ID for the payment method that you want to get prices for. see Payment Methods to get a list of payment providers. | | signature | string/undefined | false | The data shall be signed according partnerCode|externalOrderId|currency|coinAmount|network|paymentMethod|secretKey |

Buy order full example

const buyOrderTransaction = BuyOrderTransaction.createFromCoinAmount(accountReference, fiatCode, coinCode, coinAmount, walletAddress, paymentMethodId, blockchain, walletAddressTag);// From Coin Amount
alixPay.createBuyOrder(
    buyOrderTransaction,
    webhookSecretKey
    );

Result Example

{
 "externalOrderId": "string",
 "type": "string",
 "fiatAmount": 0,
 "paidAmount": 0,
 "tokenTransfer": {
   "currency": "string",
   "network": "string",
   "price": 0,
   "amount": 0,
   "address": "string",
   "txHash": "string"
 },
 "bankTransfer": {
   "bankAccountName": "string",
   "bankAccountNumber": "string",
   "bankName": "string",
   "contentPayment": "string",
   "totalPayment": 0,
   "qrUrl": "string"
 },
 "fees": {
   "systemFee": 0,
   "processingFee": 0
 },
 "status": "string",
 "descriptions": "string",
 "createdAt": "string",
 "expiresAt": "string",
 "signature": "string"
}

Creating a Sell order

alixPay.createSellOrder(
  sellOrderTransaction,
  webhookSecretKey
)

| Property | type | required | description | |---------------------------|---------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | sellOrderTransaction | Object | true | SellOrdertransaction object | | webhookSecretKey | string | true | The return url on success

SellOrderTransaction using Fiat as base amount

const sellOrderTransaction = SellOrderTransaction.createFromFiatAmount(
      partnerCode, 
      externalOrderId, 
      currency, 
      fiatAmount, 
      bankCode, 
      bankAccountNumber,
      content,
      signature,
);

| Property | type | required | description | |---------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------| | partnerCode | string | true | The customer's unique ID | | externalOrderId | string | true | The transaction's unique ID to get a list all available fiats | | currency | string | true | Coin code e.g. 'BTC' or 'ETH' see Crypto to get a list all available crypto | | fiatAmount | string/number | true | Fiat amount | | bankCode | string | true | your customer bank code ( f.e VIETCOMBANK, VIETTINBANK, TECHCOMBANK) rejected | | bankAccountNumber | string/number/undefined | false | your customer bank account number. | | content | string/undefined | false | content of transtaction | | signature | string/undefined | false |The data shall be signed according partnerCode|externalOrderId|currency|fiatAmount|bankCode|bankAccountNumber|content|secretKey |


Sell order full example

const sellOrderTransaction = SellOrderTransaction.createFromFiatAmount(partnerCode, externalOrderId, currency, fiatAmount, bankCode, bankAccountNumber, content, walletsignatureAddressTag);// From Fiat Amount
alixPay.createSellOrder(
   sellOrderTransaction,
   webhookSecretKey
);

Result Example

{
 "externalOrderId": "string",
 "type": "string",
 "fiatAmount": 0,
 "paidAmount": 0,
 "tokenTransfer": {
   "currency": "string",
   "network": "string",
   "price": 0,
   "amount": 0,
   "address": "string",
   "txHash": "string"
 },
 "bankTransfer": {
   "bankAccountName": "string",
   "bankAccountNumber": "string",
   "bankName": "string",
   "contentPayment": "string",
   "totalPayment": 0,
   "qrUrl": "string"
 },
 "fees": {
   "systemFee": 0,
   "processingFee": 0
 },
 "status": "string",
 "descriptions": "string",
 "createdAt": "string",
 "expiresAt": "string",
 "signature": "string"
}

TEMPLATE FOR NEW DESCRIPTION

Simple description

alixPay.method(param)

| Property | description | required | description | |:---------|:------------|:---------|:---------------------| | foo | string | true | Description of param |

Result Example

[
 TEMPLATE
]