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

profitwell

v1.0.1

Published

Unofficial Node.js bindings to the ProfitWell API - https://profitwellapiv2.docs.apiary.io/

Downloads

209

Readme

Field Control ♥ Maintainability Test Coverage Continuous Integration


Installation

This client is intended for server side use only.

npm install profitwell --save

Usage

const ProfitWell = require('profitwell')
const profitWell = new ProfitWell({
  apiToken: 'Wx15BlcpDfVPWbsTdNX<3'
})

Resources

Subscriptions

// Create a subscription
const response = await profitWell.subscriptions.create({
    user_id: '7927fc01',
    user_alias: 'luiz\'s alias',
    subscription_alias: 'subscription\'s alias',
    email: '[email protected]',
    plan_id: 'standard_plan',
    plan_interval: planInterval.monthly,
    plan_currency: planCurrency.BRL,
    status: subscriptionStatus.active,
    value: 12000,
    effective_date: 1514764800
})
// Upgrade/downgrade an existing subscription.
const response = await profitWell.subscriptions.update('7927fc01', {
    plan_id: 'standard_plan',
    plan_interval: planInterval.yearly,
    status: subscriptionStatus.trialing,
    value: 7500,
    effective_date: 1522432854
})
// Churn subscription
const response = await profitWell.subscriptions.churn('7927fc01', {
    churn_type: churnType.delinquent,
    effective_date: 1522432854
})
// Unchurn subscription - Remove the churn event associated with a subscription.
const response = await profitWell.subscriptions.unchurn('7927fc01')

Users

// Get the history of subscription updates you've made to a user
const response = await profitWell.users.getSubscriptions('field')
// Update a user's email address
// This can actually be any sort of text, not necessarily an email address. 
// Some prefer to store a name here instead 
const response = await profitWell.users.update('luiz', { email: '[email protected]' })
// Completely delete a user and his subscription history
const response = await profitWell.users.delete('luiz')

Plans

// List all plans.
const response = await profitWell.plans.list()
// Create a new plan
const response = await profitWell.plans.create({
    id: 'foo_plan',
    name: 'Foo plan'
})
// Update the name of an existing plan
const response = await profitWell.plans.update('foo_plan', {
    name: 'Foo plan'
})

Metrics

// Retrieve all monthly financial metrics for your company.
// Optionally scope to an individual metric and/or plan.
const response = await profitWell.metrics.getMonthly({
    plan_id: 'field_plan',
    metrics: [
      monthlyMetrics.activeCustomers,
      monthlyMetrics.churnedCustomersCancellations,
      monthlyMetrics.churnedRecurringRevenue
    ]
})
// Retrieve financial metrics broken down by day for either the current month or the last.
// Optionally scope to an individual metric and/or plan.
const response = await profitWell.metrics.getDaily({
    month: '2020-07',
    plan_id: 'field_plan3',
    metrics: [
      dailyMetrics.futureChurnMRR,
      dailyMetrics.upgradedRecurringRevenue,
      dailyMetrics.reactivatedRecurringRevenue
    ]
})
// Exclude user's data from the calculation of all metrics.
const response = await profitWell.metrics.excludeCustomer('da044c6e')

Company

// Get your company's ProfitWell account settings.
const response = await profitWell.company.getSettings()

Pull Requests

  • Add tests! Your patch won't be accepted if it doesn't have tests.
  • Document any change in behaviour. Make sure the README and any other relevant documentation are kept up-to-date.
  • Create topic branches. Don't ask us to pull from your master branch.
  • One pull request per feature. If you want to do more than one thing, send multiple pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.