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

testpaymentsdk

v1.0.4

Published

SDK for payment backends (marketplaces etc)

Downloads

9

Readme

PaymentSDK

GoodDollar PaymentSDK for vendors.

Motivation

This API will allows vendors to request and handle payment with the GoodDollar protocol in their Apps/Stores.

Node.js (Install)

Requirements:

  • Node.js
  • npm or yarn
npm install ----

or

yarn add ---- 

Method 1

generatePaymentLink(PaymentDetails:string)

Creates a payment link.

How to use?
Example Input
  var result = generatePaymentLink({
    address:'0x00521965e7bd230323c423d96c657db5b79d099f',
    recipient:'3dPB4qR3AeJ2cKsjRgajwtMaRk7N24hULg6',
    amount:'22200',
    reason:'afds',
    category:'Digital Services',
    vendorData:{
      callbackUrl:'www.google.com',
      invoiceId:'abcd'
    }
  });

The result variable will store the expected output i.e. Payment Link.

Example Output

http://wallet.gooddollar.org:3000/? code=eyJtIjoiM2RQQjRxUjNBZUoyY0tzalJnYWp3dE1hUms3TjI0aFVMZzYiLCJhIjoiM... the query param code is the base64 encrypted value returned from generateCode.

The generated code will return an object with the paymenDetails params and the ones that we already have

Example:

{
  "m":"3dPB4qR3AeJ2cKsjRgajwtMaRk7N24hULg6",
  "a":"22200",
  "r":"afds",
  "cat":"Digital Services"
}
Method 2
generatePaymentQR(PaymentDetails):DataURL

Same as above but create a QR containing the payment link from the generatePaymentLink method described above. Returns Data URL link (in string format).

How to use?
Example Input
  var result = await generatePaymentQR({
    address:'0x00521965e7bd230323c423d96c657db5b79d099f',
    recipient:'3dPB4qR3AeJ2cKsjRgajwtMaRk7N24hULg6',
    amount:'22200',
    reason:'afds',
    category:'Digital Services',
    vendorData:{
      callbackUrl:'www.google.com',
      invoiceId:'abcd'
    }
  });
Example Output

Data URL {coverted to Image} DataURLImage

Method 3
validateTx(TxData):boolean

Reads fuse blockchain for txhash and check it has a Transfer log with the amount + sha3(invoiceid/data) paid to recipient in event log data.

Listens to Transfer event with to=recipient and data=sha3(invoiceid/data) resolves promise once event detected.

How to use?
Example Input
var result = await validateTx({
  txHash:"0x16d3c01a2786ce2022ef036ed122c5ff38b1809bf14302c3b89de73cbcbcac8d",
  recipient:"0x2FaDA5F33728761648dAB4BE25BF0fE831B9dD34",
  amount:500,
  invoiceId:"receipt-id-3938383"
});
Example Output
true
Types
PaymentDetails {
  address: string,
  recipient: string,
  amount: number,
  reason: string,
  category: string,
  vendorData?: VendorMetadata
}
VendorMetadata {
  callbackUrl: URL,
  invoiceId: string,
  website: URL, 
  vendorName: string
}
TxData {
  txHash: string,
  recipient: string,
  amount: number,
  invoiceId: string,
  network?: string
}