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

skywallet-sdk

v1.1.8

Published

This sdk is designed to help merchants to accept payments by X12 coins. Providing convenient wrapper for REST API that SkyWallet provides.

Downloads

15

Readme

SkyWallet SDK

Installation

npm install skywallet-sdk

Usage

To be able to use SkyWallet sdk need to initialize it first. For that purpose need to get corresponding token and publicKey from your merchant account on https://skywallet.com. For testing purposes need to add additional property to config:

'url':'https://stage.skywallet.com:9018/api'
const SkyWallet = require('skywallet-sdk');

const config = {
	'apiKey': 'API_KEY',
	'publicKey': 'PUBLIC_KEY',
}
const order = SkyWallet.setConfigs(config);

Create new order

Once Customer is trying to pay for some item by X12 the following call should be made. Need to provide corresponding amount in X12 that customer need to pay. Invoice number on merchant side and item SKU. This call registers the order request in our system and provides corresponding integrated address from SkyWallet main wallet. Integrated address should be provided to customer to make required payment to that address. Once above mentioned called is successfully made it should register corresponding order in SkyWallet system and information about that will be available in corresponding section on skywallet.com.


const data = {
    'requestedAmount': 5.00,
    'invoiceNumber': 'invoice number',
    'SKU': 'sku',
    'language': 'en',
    'rate': 5.00,
    'price': 25.00,
    'currency': 'USD',
    'description': 'test description',
    'backToMerchantUrl': 'http://merchant.com/webhook'
}

order.createOrder(data, (orderData) => {
	console.log(orderData);
});

Get exchange rate

This call will provide capability to convert between your currency and X12 and back the amount that needed to pay.

order.getExchangeRate('X12', 'EUR', (response) => {
	console.log(response);
});

Webhook

Webhook is defined to notify merchant about order status changes. It should be called in following cases:

  1. Order status changed to “fulfilled” and has transactions with less than 10 blocks behind. Considering orders still unverified.
  2. Order status is “fulfilled” and transactions have more than 10 blocks behind. Considering order as verified.
  3. Order is “expired” but has transactions with 10 blocks behind. Considering order as verified.
  4. Order status is “expired” but no transaction received for it. When calling provided webhook making a POST request to given url from merchant and sending the following information:
{
    transactionStatus: unverified,
    orderStatus: fulfilled,
    paymentId: "3a1a12cfcf01de09",
    supportId: "TLIH2JXD",
    invoiceNumber: "code_finalflow_po",
    SKU: "98987ABC879798",
	Signature: "asdf23qafds9j29ajfas9fj29fajsa9fj29fwajfao9j"
}

Once all the transfers related to given order are verified (more than 10 blocks behind) the transactionStatus field will be equal to “verified”. Signature should be used to verify the JSON data in response with public key provided to merchant. So far webhook is getting called for each order maximum two times. If webhook is not available for some reasons retrying to call it 20 times. In case of failure order status is switching to “failed”. And email will be send to merchant requesting some action. The following response from webhook is expected: Http status code: 200

{
	status: true
}

Marking order as “failed” in case of getting following response: Http status code: 200

{
	status: false
}

Need to use following call to verify that the data received on webhook is originally from SkyWallet:

let skyWalletRequest = req.body;

order.verify(skyWalletRequest, (response) => {
	console.log(response);
});