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

hiap

v1.0.3

Published

HUAWEI In-App Purchase Server Tools

Downloads

3

Readme

Huawei In-App Purchase (IAP) Server Tools

A set of server tools that allows you to check products purchased by the user in the application.

Install from NPM:

npm i hiap --save

Use in your code:

const HIAP = require("hiap");
const hiap = new HIAP({
    "authURL": "https://oauth-login.cloud.huawei.com/oauth2/v2/token",
    "ordersURL": "https://orders-drru.iap.hicloud.com",
    "clientId": "123456789",
    "clientSecret": "secret key string",
    "publicKey": "public key string"
});
const token = hiap.getAppAccessToken();
console.log(token);

Methods available:

  • async getAppAccessToken()
  • verifyPurchaseData(data, signature)
  • async verifyProduct(productId, purchaseToken, repeat = false)
  • async getCancelledProducts(startAt = parseInt(new Date().getTime() / 1000, 10) - 2592000, maxRows = 1000, continuationToken, type = 0, repeat)

getAppAccessToken

Method is async.

This method is used to obtain an authorization token from the Huawei server.

Parameters:

  • No parameters

Returns:

  • A token string when operation is successful, error otherwise.

verifyPurchaseData

The method is used to verify the received purchase data and the corresponding signature.

Parameters (all parameters are mandatory):

  • data is a data string to verify
  • signature is a signature string received on purchase

Returns:

  • Either true or false

verifyProduct

The method is used to check the availability of purchase data on the Huawei side. Method is async.

Parameters (all parameters are mandatory):

  • productId is a string which indicates the desired Product ID
  • purchaseToken is a purchase token string received from Huawei side

Returns:

  • Objects which includes the purchaseTokenData if successful, error otherwise
  • More information: Huawei Developers

getCancelledProducts

The method is used to get a list of canceled purchases. Method is async.

Parameters (all parameters are optional):

  • startAt is a Timestamp (UTC) of the earliest canceled or refunded purchase that you want to query; if continuationToken is passed, startAt is ignored; the default value is the current timestamp minus 1 month
  • maxRows is a maximum number of query result records, the value is greater than 0; the default value and the maximum value are 1000
  • type is a query type (0 = query purchase information about consumables and non-consumables, 1 = query information about consumables, non-consumables, and subscriptions); ignored when continuationToken is passed
  • continuationToken is a token returned in the last query to query the data on the next page

Returns:

  • Objects which includes the cancelledPurchaseList array if successful, error otherwise
  • If the token continuationToken is returned, another query is required
  • More information: Huawei Developers