We've moved discussions to Discord

Stripe No such plan: error

Marcus Schappi
Hey Folks, 

I hoping you can point me in the right direction.

I'm currently runing my Jumpstart in development. 

The version I'm running forked from: 

commit 11ca7ee61e455c1ed736ddd67c9ca8a2fb3d79ee (jumpstart/master, jumpstart/HEAD)
Merge: de30f51 2e1da0e
Author: Chris Oliver <excid3@gmail.com>
Date:   Thu Jun 4 11:04:52 2020 -0500

I am getting the "No such plan: prod_HRVIOQxPMKmFUR" error when trying to subscribe to a plan.

The Error Message:
https://files.littlebird.com.au/Shared-Image-2020-06-11-08-45-23-2uzoz.png

My Rails.env is development:
https://files.littlebird.com.au/Shared-Image-2020-06-11-08-46-10-T1UUi.png

I can confirm that:

a) The plan is in Stripe's test environment:
https://files.littlebird.com.au/Shared-Image-2020-06-11-08-47-14-Xs98I.png

b) I am using the Stripe Test Credentials
I am seeing activity against the Test Token in Stripe:
https://files.littlebird.com.au/Shared-Image-2020-06-11-08-48-54-U9Wzr.png

Things I've tried: 

I've ensure that the Stripe CLI is running in my dev profile (not that I'm testing with a card that requires SCA)

web: bundle exec rails s
webpack: bin/webpack-dev-server
stripe: stripe listen --forward-to localhost:5000/webhooks/stripe

I've even gone as far as swapping out the Test Token for the one that the Stripe CLI generates.

Other things to note:

When I hit up: https://dashboard.stripe.com/test/plans, I'm redirected to https://dashboard.stripe.com/test/products .

When I hit up https://dashboard.stripe.com/test/plans/prod_HRVIOQxPMKmFUR , I get
https://files.littlebird.com.au/Shared-Image-2020-06-11-09-03-13-6Nl0d.png .

When I click the "View all plans" button, I can see my plan under "products".
https://files.littlebird.com.au/Shared-Image-2020-06-11-09-04-20-plIcI.png


I've read:
https://jumpstartrails.com/discussions/200
(No good. I'm in dev env and using test strip token. Plan was made in stripe's test mode).
and
https://jumpstartrails.com/discussions/346
(The Stripe CLI is running, and I'm not doing market place style payments).

https://jumpstartrails.com/discussions/120
(The right API keys are being used, as I can see logs in Stripe and in the console)

Loading development environment (Rails 6.0.3.1)
[1] pry(main)> Rails.env
=> "development"
[2] pry(main)> Stripe.api_key
=> "sk_test_[REDACTED]"

Cheers, 

Marcus





Marcus Schappi
Ok folks, I've figured it out.

Stripe doesn't seem to allow you to create or view plans from their dashboard any more.

They do allow you to create products. Products are distinct from plans.

Create a product in Stripe over at: https://dashboard.stripe.com/test/products

And then run in the console: 

plan = Stripe::Plan.create({
   amount: 9900,
   currency: 'usd',
   interval: 'month',
   product: '<id of your product here>',
 })

puts plan.id # this is the plan ID you put into Jumpstart .

The stripe docs are available here: https://stripe.com/docs/api/plans/object

Hope this helps folks in the future.

Chris Oliver
That's tripped me (and everyone else) a few times. They've got Products, Plans, and Prices each with their own IDs. Pretty easy to grab the wrong one. :)
Marcus Schappi
Just a heads up, you can no longer grab the Plan from the GUI.
Chris Oliver
It looks like you can probably use a Price ID instead of a Plan ID now.
Chris Oliver
I'll have to do some inspecting and see what we'll need to change in the Pay gem for this.
Kasper Andkjaer
Hi  Chris Oliver any news about this. I just bought a license and I get the same error as described above. "No such plan: 'prod_HyhOxcCB0S7gdo'" I guess it's because Stripe has changed the way they handle plans and products.
Joshua LeBlanc
Kasper Andkjaer You're looking for the price ID now. 

On stripe, create a new PRODUCT. Once you're done, look at the PRICES table, and copy the value from the API ID column.
Chris Oliver
Yeah, Price ID works interchangeably with Plan ID as Joshua LeBlanc  mentioned. 👍
Notifications
You’re not receiving notifications from this thread.