Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ms-payments

makeomatic5MIT8.6.2

Core of the microservice for handling payments

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

changelog

8.6.2 (2021-10-08)

Bug Fixes

8.6.1 (2021-08-23)

Bug Fixes

8.6.0 (2021-08-09)

Bug Fixes

Features

8.5.2 (2021-02-05)

8.5.1 (2020-09-25)

8.5.0 (2020-09-25)

Features

8.4.1 (2020-08-31)

Bug Fixes

8.4.0 (2020-08-27)

Features

8.3.1 (2020-06-10)

Bug Fixes

  • default start/end params for tx sync (379541e)

8.3.0 (2020-06-10)

Features

8.2.2 (2020-06-01)

Bug Fixes

  • ignore out of sync cancelled status when we want to cancel (#112) (6ccd6ec)

8.2.1 (2020-05-29)

Bug Fixes

  • migration key & goto statement (e9760b1)

8.2.0 (2020-05-29)

Features

8.1.0 (2020-05-26)

Bug Fixes

Features

  • endpoint to sync Updated txs (a7c4701)

8.0.1 (2020-03-19)

Bug Fixes

8.0.0 (2020-01-26)

Features

BREAKING CHANGES

  • min runtime required is node 12.14.x, configuration changes in transient dependencies

7.0.4 (2019-12-11)

Bug Fixes

  • add another log handler to bill (80e893d)
  • cancel suspended plans (be3004d)

7.0.3 (2019-11-28)

Bug Fixes

  • deps: @microfleet/transport-amqp, dlock, dev deps (c7ca6f5)

7.0.2 (2019-11-22)

Bug Fixes

  • deploy: remove yarn cache (04e4818)

7.0.1 (2019-11-22)

Bug Fixes

  • gracefully handle out of sync of plan deletes (89df755)

7.0.0 (2019-11-21)

Features

BREAKING CHANGES

  • uses node 12, slightly change config formats, upgrades all deps with multiple breaking changes

6.3.7 (2019-08-22)

Bug Fixes

  • access to sale.list via internal dispatch (d544e98)

6.3.6 (2019-08-22)

Bug Fixes

  • use internal dispatch for validation, update deps (0d8a0eb)

6.3.5 (2019-08-09)

Bug Fixes

  • capture the actual error (a5c264b)

6.3.4 (2019-07-23)

Bug Fixes

6.3.3 (2019-07-18)

Bug Fixes

  • add extra logging for broken agreements (a1a06c7)

6.3.2 (2019-07-17)

Bug Fixes

  • paypal payments use its own config for client (#94) (3aad9fd)

6.3.1 (2019-07-16)

Bug Fixes

6.3.0 (2019-07-13)

Features

  • paypal sale to authorize-capture (#93) (28d3b54)

6.2.3 (2019-07-09)

Bug Fixes

  • release process improved (aca98af)