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

@panda-clouds/stripe

v1.0.1

Published

A Node wrapper for stripe

Downloads

2

Readme

PCStripe

maintained by PandaClouds.com

PCStripe provides a clean way to validate data in Parse Sever Cloud Code.

Installation

  1. If you want to use this library, you first need to install the Node.js.

  2. When you install node.js, will also be installed npm.

  3. Please run the following command.

npm install --save @panda-clouds/stripe

API Keys

Problem: It's a bad secuirty practice to commit our Stripe API Keys to this repo.

Solution: we have devised a system for each user to create a .gitignored file called 'apiKeys.js' that contains your specific keys. Run these commands to create the boiler plate "apiKeys.js" file. Git should never ask you to commit this file.

  1. open terminal.
  2. cd /my/path/to/proj
  3. echo -e "module.exports = function() {\n\tprocess.env.STRIPE_SECRET_KEY = 'sk_test_123';\n\tprocess.env.STRIPE_CLIENT_ID = 'ca_123';\n\tprocess.env.STRIPE_REFRESH_TOKEN = 'rt_123';\n\tprocess.env.STRIPE_AUTH_CODE = 'ac_123';\n};\n" > apiKeys.js
  4. open the file and replace sk_test_123 with your key, etc

Usage

Node.js

const PCStripe = require('@panda-clouds/stripe');


// example usage

You can replace PCStripe with any variable.

Methods

Unit Tests are an additional resource for learning functionality.

- mustExist()

requires the property to be set, else throws error

Example:

Parse.Cloud.beforeSave('Book', request =>{
	const data = new PCStripe(request);
	data.prop('title').mustExist();    // will throw Error if request.object.get('title') doesn't exist
});

- getUserIdFromStripe(auth_code)

Using the stripe authentication code, retrieves the user data for the user in the OAuth workflow.

args: auth_code: stripe authentication code provided by OAuth workflow.

return: json object with user details.

Example:

const stripe = new PCStripe('shhh_secret_key');
const response = await stripe.getUserIdFromStripe('auth_code');

- getUserIdFromStripeRefresh(refresh_token)

Using the refresh token, retrieves the user data for the user in the oauth workflow.

args: refresh_token: refresh token provided by getUserIdFromStripe for re-use after auth code expires.

return: json object with user details.

Example:

const stripe = new PCStripe('shhh_secret_key');
const response = await stripe.getUserIdFromStripeRefresh('refresh_token');

- transferToConnectedAccount(dest_acct_id, payment_amount, group_id)

Transfer funds to a connected stripe account.

args: dest_acct_id: stripe account id of the account to transfer funds into. payment_amount: amount in cents(USD) to transfer. group_id: used for book keeping purposes in order for transactions to be grouped together. return: json object returned by stripe regarding transaction.

Example:

const stripe = new PCStripe('shhh_secret_key');
const response = await stripe.transferToConnectedAccount('acct_lnm', 350, 'lnm_payout_group');

Contributions

Pull requests are welcome! here is a checklist to speed things up:

  • modify PCStripe.js
  • add unit tests in PCStripe.spec.js
  • run npm test
  • document method in README.md
  • add your name to 'Contributors' in README.md

Contributors

(Add your name)