longshotlabs / meteor-plans-stripe

Stripe service add-on for aldeed:plans package
https://atmospherejs.com/aldeed/plans-stripe
MIT License
18 stars 11 forks source link

Didn't create Stripe Plan? #7

Closed MichaelJCole closed 7 years ago

MichaelJCole commented 7 years ago

Hi,

Trying this out. I got this error when trying to subscribe to my first plan:

AppPlans: There was a problem creating Stripe customer: No such plan: betaStarter [Service subscription error trying to add plan betaStarter for user WKP8qqrxxxxT7sMQT

It's from here.

Looking at the code, I think it's expecting the plan to already be made. Even though payOptions needs an amount.

On first use, I thought the plan data would be stored in the Meteor code. Plans could be setup with the Stripe API.

My use case was something like this (I wanted the limits to be stored with the price):

AppPlans.plans = {};

// Active Plans

AppPlans.plans.betaFreemium = {
  name: 'Freemium',
  amount: 0,
  limit: 5,
  description: 'Fremium Plan',
  action: 'Try Risk-Free',
};
AppPlans.define('betaFreemium');

AppPlans.plans.betaStarter = {
  name: 'Starter',
  amount: 1500,
  limit: 15,
  description: 'Starter Plan',
};
AppPlans.define('betaStarter', {
  services: [
    {
      name: 'stripe',
      planName: 'betaStarter',
      payOptions: _.pick(AppPlans.plans.betaStarter, 'name','description','amount'),
    }
  ],
});

Is the project under active development?

aldeed commented 7 years ago

Currently you have to go into Stripe and define the plan yourself first. It may be possible to have the package create it for you. I'd accept a PR if someone figures that out.

This package is used in some production apps so the pieces used by those apps are "active" in that we would fix any issues affecting the apps that use it. No one is actively adding new features, but I can look at PRs and/or work with additional maintainers if anyone is interested.

MichaelJCole commented 7 years ago

lol, I set out to automate this, then made them manually.

There's are good business/opsec reasons to separate the plans from the code.

Also, I see now that payOptions needs the amount to get the stripe token. Anyways, all is well :-)