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

ms-payments

v8.6.2

Published

Core of the microservice for handling payments

Downloads

45

Readme

Microservice for handling PayPal / Stripe payments over AMQP transport layer

Build Status Code Climate npm version semantic-release Commitizen friendly codecov.io FOSSA Status

API Documentation

Please follow this link.

Tests

Before running tests, you should create your "/test/.env" file with stripe private and public keys.
Details are in "./test/.env.example".

Plans

Plans workflow

Plan is a PayPal object first, then database object stored on our side. Keep that in mind all the time.

PayPal follows specific schema for plan description which describes how subscriber would be charged.

On our side we need to attach additional data: if plan is available to subscribe and subscription options.

After plan has been created it becomes available for users to subscribe.

Create plan

To create a plan you need to provide certain data for create endpoint.

{
  "hidden": <true|false>, // use true to make plan invisible to normal users
  "alias": <string>, // use this to set up plan alias (for your convenience)
  "title": <string>, // plan title that is going to be displayed to user
  "subscriptions": [<subscription>], // this is most important part: links our metadata with plan charging models
  "plan": <plan> // charging models for plan, this must be strictly as paypal wants (see it's documentation or plan.json)
}

Now onto subscriptions.

{
  "models": <number>, // number of models added on each billing cycle (month or year)
  "price": <number>, // price of additional models (for 1 model)
  "name": <string> // name of subscription, see below
}

Subscription name must be exactly the same as plan payment definition name.

As for plan, you must specify "name", "description", "type", "payment_definitions" and "merchant_preferences" only.

{
  "name": <string>, // plan name, could be anything
  "description": <string>, // plan description, ditto
  "type": "infinite", // paypal provides 2 options, use infinite only
  "payment_definitions": [<definition>], // most important part, defines charging models
  "merchant_preferences": [<preference>] // additional data, not really important
}

Payment definitions are simple and as with subscriptions you need to provide only 2 of them: monthly and annual.

{
  "name": <string>, // must be exactly the same as in subscription
  "type": "regular", // paypal provides option for trial plans too, but it's not implemented on our side
  "frequency_interval": "1", // string! how often to charge, you don't need to use anything more than 1
  "frequency": <month|year>, // paypal supports daily and weekly plans too, not implemented
  "cycles": "0", // must be "0" (string, not number)
  "amount": {
    "currency": "USD", // can be any ISO 4217 code you want
    "value": "10.0", // string! any valid ISO 4217 amount
  },
  "charge_models": [<charge>] // apply tax here
}

Charge model allows you to apply tax and shipping (not applicable for us).

{
  "type": <tax|shipping>, // self-descriptive
  "amount": {
    "currency": "USD", // can be any ISO 4217 code you want
    "value": "10.0", // string! any valid ISO 4217 amount
  }
}

License

FOSSA Status