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

algopay-js

v1.1.1

Published

AlgoPay JavaScript Widget

Downloads

129

Readme

algo-pay-only-javascript

Work in progress project to port AlgoPay react to pure javascript

build command (to dist folder, will create if does not exist):

npm run build

to correctly show css after bulding, modify the index.html that is generated in the dist folder by:

  • removing one of the <link> tags for the css
  • removing the numeric hash from the remaining <link>tag so that the href reads "styles.css"
  • renaming the js file to "index.js"
  • renaming the <script> tag src to "index.js"

Finally, copy your styles.css file into the dist folder.

Test build command on localhost:

serve -s dist

Algopay 2.1 Update: Add Post to custom URL (temp documentation for post)

in window details, add "backend_enable":false Script will work like always.

In window details, add "backend_enable":true,backend_url":"your_backend_url",backend_value1=your_value...." TXID and custom parameters will be sent by post to chosen URL

Example using pseudoPHP:

//Get the POST data $update = json_decode(file_get_contents("php://input"), TRUE); //Get the TXID $txid = $update["txid"]; //Get value 1, lets say we send customer email $email = $update["backend_value1"];

//Wait block for being processed sleep(5);

//Get the TX from algoexplorer $api_url = "https://algoexplorerapi.io/v2/transactions/pending/".$txid.""; $json_data = file_get_contents($api_url); $response_data = json_decode($json_data, true);

//There are several ways to do this (nonce, check only latest blocks) but this time we will check if transfer is not being reused //Define receiver account and price $account = "K3NSXYMHPRCK7PMYT3QUQXUGPZJ4MKWJXW2HJRYPVMQUMKJAOJEIEO4HK4" $price = 20000 //Look in database if TXID is being reinjected to disallow reusing payments $sql = "SELECT * FROM payments WHERE txid =".$txid.""; $result = $conn->query($sql); //If payment is being reused, exit. Client trying to hack. if (!empty($result)) { exit(); }

//If the paid amount is correct and the receiver address is correct and the product is still on sale process it if ($response_data["txn"]["txn"]["aamt"] == $price) { if ($response_data["txn"]["txn"]["arcv"] == $account) { if ($on_sale == 1) { //Mark product as sold, and save TxId to avoid future reuse $sql = "UPDATE payments set on_sale = 0, txid = $txid, email = $email WHERE id = $id; $conn->query($sql); //DO ACTIONS, for example, sending a confirmation email require 'PHPMailer/src/PHPMailer.php'; (...) $mail->addAddress($email) $mail->send(); }}

**THIS IS NOT A COMPLETE INTEGRATION, BUT ITS VALID ESPECIALLY FOR INEXHAUSTIBLE PRODUCTS (Like API keys or replaceable physical products) **** Not fully tested, make your own test!