RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.

Home Page:http://railsapps.github.io/rails-stripe-membership-saas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bugs when registering with invalid card number.

dxypher opened this issue · comments

When I try to signup for a subscription plan with a test CC number from Stripe... I get a JSON error message. It simply renders the JSON error in the browser ( the errors themselves are wrong it seems ).

screen shot 2015-04-11 at 12 55 48 pm
screen shot 2015-04-11 at 12 55 34 pm
screen shot 2015-04-11 at 1 04 34 pm

I'm getting this same error.

I haven't been able to reproduce this issue using the version of the app in the GitHub repo (with Ruby 2.2.0 and Rails 4.2.1). I saw this issue briefly in development when I was using an unreliable Internet connection. I assumed it was a failure to connect with Stripe. Can we identify conditions needed to reproduce this issue?

I’m running Ruby 2.2.0 and Rails 4.2.0

I have a solid internet connection and I have tried it on a couple of different internet connections with both Chrome and Safari.
I checked the Stripe log, there is no connection being made.

I still get:

"{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”}

This is my log:

Started GET "/users/sign_up?plan=bronze" for ::1 at 2015-04-14 09:54:55 -0700
Processing by RegistrationsController#new as HTML
Parameters: {"plan"=>”bronze"}
User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 4]]
Redirected to http://localhost:3000/content/bronze
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 41ms (ActiveRecord: 1.6ms)

Started GET "/content/bronze" for ::1 at 2015-04-14 09:54:56 -0700
Processing by ContentController#bronze as HTML
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 4]]
Rendered content/bronze.html.erb within layouts/application (2.8ms)
Rendered layouts/_navigation_links.html.erb (0.3ms)
Rendered layouts/_navigation.html.erb (3.2ms)
Rendered layouts/_messages.html.erb (0.2ms)
Completed 200 OK in 359ms (Views: 354.1ms | ActiveRecord: 0.5ms)

Started DELETE "/users/sign_out" for ::1 at 2015-04-14 09:54:59 -0700
Processing by Devise::SessionsController#destroy as HTML
Parameters: {"authenticity_token"=>”abunchofletters="}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 ["id", 4] BEGIN
(0.3ms) COMMIT
Redirected to http://localhost:3000/
Completed 302 Found in 9ms (ActiveRecord: 1.1ms)

Started GET "/" for ::1 at 2015-04-14 09:54:59 -0700
Processing by VisitorsController#index as HTML
Rendered visitors/index.html.erb within layouts/application (1.0ms)
Rendered layouts/_navigation_links.html.erb (0.4ms)
Rendered layouts/_navigation.html.erb (1.9ms)
Rendered layouts/_messages.html.erb (0.1ms)
Completed 200 OK in 236ms (Views: 234.4ms | ActiveRecord: 0.0ms)

Started GET "/users/sign_up?plan=bronze" for ::1 at 2015-04-14 09:55:04 -0700
Processing by RegistrationsController#new as HTML
Parameters: {"plan"=>”bronze"}
Plan Load (0.8ms) SELECT "plans".* FROM "plans" ORDER BY "plans"."id" DESC LIMIT 1
Plan Load (0.5ms) SELECT "plans".* FROM "plans" WHERE "plans"."stripe_id" = $1 LIMIT 1 [["stripe_id", “bronze"]]
Rendered /Users/mark/.rvm/gems/ruby-2.2.0/gems/payola-payments-1.3.1/app/views/payola/transactions/_stripe_header.html.erb (0.2ms)
Plan Load (0.6ms) SELECT "plans".* FROM "plans"
Rendered devise/registrations/new.html.erb within layouts/application (15.7ms)
Rendered layouts/_navigation_links.html.erb (0.7ms)
Rendered layouts/_navigation.html.erb (3.2ms)
Rendered layouts/_messages.html.erb (0.3ms)
Completed 200 OK in 262ms (Views: 252.9ms | ActiveRecord: 1.9ms)

Started POST "/users" for ::1 at 2015-04-14 09:55:46 -0700
Processing by RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>”abunchofletters", "user"=>{"plan_id"=>"3", "email"=>”name@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}
Plan Load (0.6ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 [["id", 3]]
CACHE (0.1ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 ["id", 3] BEGIN
Plan Exists (0.7ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = ‘bronze' AND "plans"."id" != 3) LIMIT 1
User Exists (0.5ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ’name@gmail.com' LIMIT 1
SQL (7.1ms) INSERT INTO "users" ("email", "encrypted_password", "plan_id", "role", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" ["email", “name@gmail.com"], ["encrypted_password", “somepassword"], ["plan_id", 3], ["role", 2], ["created_at", "2015-04-14 16:55:46.739890"], ["updated_at", "2015-04-14 16:55:46.739890"] COMMIT
(0.3ms) BEGIN
SQL (1.0ms) UPDATE "users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "last_sign_in_ip" = $3, "current_sign_in_ip" = $4, "sign_in_count" = $5, "updated_at" = $6 WHERE "users"."id" = $7 ["last_sign_in_at", "2015-04-14 16:55:46.769102"], ["current_sign_in_at", "2015-04-14 16:55:46.769102"], ["last_sign_in_ip", "::1/128"], ["current_sign_in_ip", "::1/128"], ["sign_in_count", 1], ["updated_at", "2015-04-14 16:55:46.771162"], ["id", 5] COMMIT
(0.4ms) BEGIN
Payola::Subscription Exists (0.6ms) SELECT 1 AS one FROM "payola_subscriptions" WHERE "payola_subscriptions"."guid" IS NULL LIMIT 1
(0.2ms) ROLLBACK
(0.3ms) BEGIN
Plan Exists (0.4ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = ‘bronze' AND "plans"."id" != 3) LIMIT 1
(0.3ms) COMMIT
Completed 400 Bad Request in 193ms (Views: 0.9ms | ActiveRecord: 15.2ms)

Mark

On Apr 14, 2015, at 2:47 AM, Daniel Kehoe notifications@github.com wrote:

I haven't been able to reproduce this issue using the version of the app in the GitHub repo (with Ruby 2.2.0 and Rails 4.2.1). I saw this issue briefly in development when I was using an unreliable Internet connection. I assumed it was a failure to connect with Stripe. Can we identify conditions needed to reproduce this issue?


Reply to this email directly or view it on GitHub #116 (comment).

I have my site running on heroku too and it still gives this same error when you submit the payment on a subscription plan, as it did in development:

"{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”}

Heroku logs:
2015-04-15T03:45:51.030143+00:00 app[web.1]: Processing by VisitorsController#index as HTML
2015-04-15T03:45:51.036152+00:00 app[web.1]: Rendered layouts/_navigation_links.html.erb (0.3ms)
2015-04-15T03:45:51.036254+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (0.7ms)
2015-04-15T03:45:51.036640+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.2ms)
2015-04-15T03:45:51.042638+00:00 heroku[router]: at=info method=GET path="/" herokuapp.com request_id=6ba9f4aa-113c-4587-8c0a-f0a1aca65e54 fwd="50.152.172.74" dyno=web.1 connect=3ms service=17ms status=200 bytes=3755
2015-04-15T03:45:53.639790+00:00 heroku[router]: at=info method=GET path="/users/sign_up?plan=bronze" host=herokuapp.com request_id=be9f24ef-98ba-442b-b56c-8aec4e9150af fwd="50.152.172.74" dyno=web.1 connect=16ms service=41ms status=200 bytes=5338
2015-04-15T03:45:53.607014+00:00 app[web.1]: Started GET "/users/sign_up?plan=bronze" for 50.152.172.74 at 2015-04-15 03:45:53 +0000
2015-04-15T03:45:53.620608+00:00 app[web.1]: Plan Load (1.9ms) SELECT "plans".* FROM "plans" WHERE "plans"."stripe_id" = $1 LIMIT 1 [["stripe_id", “bronze"]]
2015-04-15T03:45:53.628741+00:00 app[web.1]: Plan Load (2.0ms) SELECT "plans".* FROM "plans"
2015-04-15T03:45:53.635218+00:00 app[web.1]: Rendered layouts/_navigation_links.html.erb (0.6ms)
2015-04-15T03:45:53.635340+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (1.0ms)
2015-04-15T03:45:53.635799+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.2ms)
2015-04-15T03:45:53.610428+00:00 app[web.1]: Processing by RegistrationsController#new as HTML
2015-04-15T03:45:53.610437+00:00 app[web.1]: Parameters: {"plan"=>”bronze"}
2015-04-15T03:45:53.614542+00:00 app[web.1]: Plan Load (2.0ms) SELECT "plans".* FROM "plans" ORDER BY "plans"."id" DESC LIMIT 1
2015-04-15T03:45:53.622094+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.2.0/gems/payola-payments-1.3.1/app/views/payola/transactions/_stripe_header.html.erb (0.1ms)
2015-04-15T03:45:53.633438+00:00 app[web.1]: Rendered devise/registrations/new.html.erb within layouts/application (11.5ms)
2015-04-15T03:45:53.636150+00:00 app[web.1]: Completed 200 OK in 26ms (Views: 12.6ms | ActiveRecord: 5.9ms)
2015-04-15T03:46:32.950677+00:00 app[web.1]: Started POST "/users" for 50.152.172.74 at 2015-04-15 03:46:32 +0000
2015-04-15T03:46:33.091524+00:00 app[web.1]: Plan Load (1.8ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 [["id", 3]]
2015-04-15T03:46:33.107237+00:00 app[web.1]: Plan Exists (5.9ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = ‘bronze' AND "plans"."id" != 3) LIMIT 1
2015-04-15T03:46:33.117204+00:00 app[web.1]: SQL (2.7ms) INSERT INTO "users" ("email", "encrypted_password", "plan_id", "role", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["email", “myemail@gmail.com"], ["encrypted_password", “mylongpassword."], ["plan_id", 3], ["role", 2], ["created_at", "2015-04-15 03:46:33.111260"], ["updated_at", "2015-04-15 03:46:33.111260"]]
2015-04-15T03:46:33.127694+00:00 app[web.1]: (3.6ms) BEGIN
2015-04-15T03:46:33.135384+00:00 app[web.1]: (3.0ms) COMMIT
2015-04-15T03:46:33.192473+00:00 app[web.1]: Payola::Subscription Exists (3.3ms) SELECT 1 AS one FROM "payola_subscriptions" WHERE "payola_subscriptions"."guid" IS NULL LIMIT 1
2015-04-15T03:46:32.953970+00:00 app[web.1]: Processing by RegistrationsController#create as HTML
2015-04-15T03:46:32.954010+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>”longtokenpassword", "user"=>{"plan_id"=>"3", "email"=>”myemail@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}
2015-04-15T03:46:33.088709+00:00 app[web.1]: Plan Load (1.9ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 [["id", 3]]
2015-04-15T03:46:33.094438+00:00 app[web.1]: (2.0ms) BEGIN
2015-04-15T03:46:33.121295+00:00 app[web.1]: (3.3ms) COMMIT
2015-04-15T03:46:33.110866+00:00 app[web.1]: User Exists (2.2ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ‘myemail@gmail.com' LIMIT 1
2015-04-15T03:46:33.131894+00:00 app[web.1]: SQL (2.3ms) UPDATE "users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "last_sign_in_ip" = $3, "current_sign_in_ip" = $4, "sign_in_count" = $5, "updated_at" = $6 WHERE "users"."id" = $7 [["last_sign_in_at", "2015-04-15 03:46:33.122674"], ["current_sign_in_at", "2015-04-15 03:46:33.122674"], ["last_sign_in_ip", "50.152.172.74/32"], ["current_sign_in_ip", "50.152.172.74/32"], ["sign_in_count", 1], ["updated_at", "2015-04-15 03:46:33.127953"], ["id", 2]]
2015-04-15T03:46:33.187527+00:00 app[web.1]: (1.9ms) BEGIN
2015-04-15T03:46:33.198128+00:00 app[web.1]: (1.8ms) ROLLBACK
2015-04-15T03:46:33.201595+00:00 app[web.1]: (1.7ms) BEGIN
2015-04-15T03:46:33.216772+00:00 heroku[router]: at=info method=POST path="/users" host=herokuapp.com request_id=b2689ce6-be09-4921-b1a4-c55c00102d62 fwd="50.152.172.74" dyno=web.1 connect=2ms service=268ms status=400 bytes=1071
2015-04-15T03:46:33.205560+00:00 app[web.1]: Plan Exists (1.9ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = 'bronze' AND "plans"."id" != 3) LIMIT 1
2015-04-15T03:46:33.210884+00:00 app[web.1]: Completed 400 Bad Request in 257ms (Views: 0.7ms | ActiveRecord: 70.8ms)
2015-04-15T03:46:33.208785+00:00 app[web.1]: (1.8ms) COMMIT
2015-04-15T03:46:44.371515+00:00 heroku[router]: at=info method=GET path="/users/sign_up?plan=bronze" host=herokuapp.com request_id=a2ce248f-4105-455c-816d-98a6c1b21a19 fwd="50.152.172.74" dyno=web.1 connect=1ms service=13ms status=302 bytes=1356
2015-04-15T03:46:44.362937+00:00 app[web.1]: Parameters: {"plan"=>”bronze"}
2015-04-15T03:46:44.488876+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.1ms)
2015-04-15T03:46:44.366518+00:00 app[web.1]: User Load (1.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
2015-04-15T03:46:44.367719+00:00 app[web.1]: Filter chain halted as :require_no_authentication rendered or redirected
2015-04-15T03:46:44.488627+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (0.6ms)
2015-04-15T03:46:44.367867+00:00 app[web.1]: Completed 302 Found in 5ms (ActiveRecord: 1.9ms)
2015-04-15T03:46:44.481438+00:00 app[web.1]: User Load (1.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
2015-04-15T03:46:44.362929+00:00 app[web.1]: Processing by RegistrationsController#new as HTML
2015-04-15T03:46:44.474095+00:00 app[web.1]: Started GET "/content/bronze" for 50.152.172.74 at 2015-04-15 03:46:44 +0000
2015-04-15T03:46:44.488572+00:00 app[web.1]: Rendered layouts/_navigation_links.html.erb (0.3ms)
2015-04-15T03:46:44.359217+00:00 app[web.1]: Started GET "/users/sign_up?plan=bronze" for 50.152.172.74 at 2015-04-15 03:46:44 +0000
2015-04-15T03:46:44.367561+00:00 app[web.1]: Redirected to https://herokuapp.com/content/bronze
2015-04-15T03:46:44.478047+00:00 app[web.1]: Processing by ContentController#onetime as HTML
2015-04-15T03:46:44.487175+00:00 app[web.1]: Rendered content/bronze.html.erb within layouts/application (0.4ms)
2015-04-15T03:46:44.489169+00:00 app[web.1]: Completed 200 OK in 11ms (Views: 7.0ms | ActiveRecord: 1.9ms)
2015-04-15T03:46:44.538128+00:00 heroku[router]: at=info method=GET path="/content/bronze" host=herokuapp.com request_id=1e5a72f5-01a0-49ad-8c99-e95a514c7581 fwd="50.152.172.74" dyno=web.1 connect=1ms service=64ms status=200 bytes=2927
2015-04-15T03:46:53.796123+00:00 heroku[router]: at=info method=POST path="/users/sign_out" host=herokuapp.com request_id=66e9fa0d-e1e7-4c48-8a05-7bd4f37507e6 fwd="50.152.172.74" dyno=web.1 connect=2ms service=26ms status=302 bytes=877
2015-04-15T03:46:53.771984+00:00 app[web.1]: Started DELETE "/users/sign_out" for 50.152.172.74 at 2015-04-15 03:46:53 +0000
2015-04-15T03:46:53.784994+00:00 app[web.1]: (1.7ms) BEGIN
2015-04-15T03:46:53.899357+00:00 app[web.1]: Started GET "/" for 50.152.172.74 at 2015-04-15 03:46:53 +0000
2015-04-15T03:46:53.910225+00:00 app[web.1]: Rendered visitors/index.html.erb within layouts/application (1.0ms)
2015-04-15T03:46:53.788540+00:00 app[web.1]: Redirected to https://herokuapp.com/
2015-04-15T03:46:53.914672+00:00 app[web.1]: Completed 200 OK in 7ms (Views: 5.8ms | ActiveRecord: 0.0ms)
2015-04-15T03:46:53.777712+00:00 app[web.1]: Processing by Devise::SessionsController#destroy as HTML
2015-04-15T03:46:53.777818+00:00 app[web.1]: Parameters: {"authenticity_token"=>”somelongtoken"}
2015-04-15T03:46:53.787539+00:00 app[web.1]: (1.7ms) COMMIT
2015-04-15T03:46:53.788694+00:00 app[web.1]: Completed 302 Found in 11ms (ActiveRecord: 5.4ms)
2015-04-15T03:46:53.914049+00:00 app[web.1]: Rendered layouts/_navigation_links.html.erb (0.4ms)
2015-04-15T03:46:53.907947+00:00 app[web.1]: Processing by VisitorsController#index as HTML
2015-04-15T03:46:53.914394+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.1ms)
2015-04-15T03:46:53.781304+00:00 app[web.1]: User Load (1.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
2015-04-15T03:46:53.914080+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (1.0ms)
2015-04-15T03:46:53.919262+00:00 heroku[router]: at=info method=GET path="/" host=herokuapp.com request_id=48632915-c2c0-49e7-b951-d3d17e0f9085 fwd="50.152.172.74" dyno=web.1 connect=1ms service=25ms status=200 bytes=3755

Mark

On Apr 14, 2015, at 10:16 AM, wrote:

I’m running Ruby 2.2.0 and Rails 4.2.0

I have a solid internet connection and I have tried it on a couple of different internet connections with both Chrome and Safari.

I still get:

"{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”}

This is my log:

Started GET "/users/sign_up?plan=bronze" for ::1 at 2015-04-14 09:54:55 -0700
Processing by RegistrationsController#new as HTML
Parameters: {"plan"=>”bronze"}
User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 4]]
Redirected to http://localhost:3000/content/bronze http://localhost:3000/content/bronze
Filter chain halted as :require_no_authentication rendered or redirected
Completed 302 Found in 41ms (ActiveRecord: 1.6ms)

Started GET "/content/bronze" for ::1 at 2015-04-14 09:54:56 -0700
Processing by ContentController#bronze as HTML
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 [["id", 4]]
Rendered content/bronze.html.erb within layouts/application (2.8ms)
Rendered layouts/_navigation_links.html.erb (0.3ms)
Rendered layouts/_navigation.html.erb (3.2ms)
Rendered layouts/_messages.html.erb (0.2ms)
Completed 200 OK in 359ms (Views: 354.1ms | ActiveRecord: 0.5ms)

Started DELETE "/users/sign_out" for ::1 at 2015-04-14 09:54:59 -0700
Processing by Devise::SessionsController#destroy as HTML
Parameters: {"authenticity_token"=>”abunchofletters="}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT 1 ["id", 4] BEGIN
(0.3ms) COMMIT
Redirected to http://localhost:3000/ http://localhost:3000/
Completed 302 Found in 9ms (ActiveRecord: 1.1ms)

Started GET "/" for ::1 at 2015-04-14 09:54:59 -0700
Processing by VisitorsController#index as HTML
Rendered visitors/index.html.erb within layouts/application (1.0ms)
Rendered layouts/_navigation_links.html.erb (0.4ms)
Rendered layouts/_navigation.html.erb (1.9ms)
Rendered layouts/_messages.html.erb (0.1ms)
Completed 200 OK in 236ms (Views: 234.4ms | ActiveRecord: 0.0ms)

Started GET "/users/sign_up?plan=bronze" for ::1 at 2015-04-14 09:55:04 -0700
Processing by RegistrationsController#new as HTML
Parameters: {"plan"=>”bronze"}
Plan Load (0.8ms) SELECT "plans".* FROM "plans" ORDER BY "plans"."id" DESC LIMIT 1
Plan Load (0.5ms) SELECT "plans".* FROM "plans" WHERE "plans"."stripe_id" = $1 LIMIT 1 [["stripe_id", “bronze"]]
Rendered /Users/mark/.rvm/gems/ruby-2.2.0/gems/payola-payments-1.3.1/app/views/payola/transactions/_stripe_header.html.erb (0.2ms)
Plan Load (0.6ms) SELECT "plans".* FROM "plans"
Rendered devise/registrations/new.html.erb within layouts/application (15.7ms)
Rendered layouts/_navigation_links.html.erb (0.7ms)
Rendered layouts/_navigation.html.erb (3.2ms)
Rendered layouts/_messages.html.erb (0.3ms)
Completed 200 OK in 262ms (Views: 252.9ms | ActiveRecord: 1.9ms)

Started POST "/users" for ::1 at 2015-04-14 09:55:46 -0700
Processing by RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>”abunchofletters", "user"=>{"plan_id"=>"3", "email"=>”name@gmail.com mailto:name@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}}
Plan Load (0.6ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 [["id", 3]]
CACHE (0.1ms) SELECT "plans".* FROM "plans" WHERE "plans"."id" = $1 LIMIT 1 ["id", 3] BEGIN
Plan Exists (0.7ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = ‘bronze' AND "plans"."id" != 3) LIMIT 1
User Exists (0.5ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ’name@gmail.com mailto:name@gmail.com' LIMIT 1
SQL (7.1ms) INSERT INTO "users" ("email", "encrypted_password", "plan_id", "role", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" ["email", “name@gmail.com mailto:name@gmail.com"], ["encrypted_password", “somepassword"], ["plan_id", 3], ["role", 2], ["created_at", "2015-04-14 16:55:46.739890"], ["updated_at", "2015-04-14 16:55:46.739890"] COMMIT
(0.3ms) BEGIN
SQL (1.0ms) UPDATE "users" SET "last_sign_in_at" = $1, "current_sign_in_at" = $2, "last_sign_in_ip" = $3, "current_sign_in_ip" = $4, "sign_in_count" = $5, "updated_at" = $6 WHERE "users"."id" = $7 ["last_sign_in_at", "2015-04-14 16:55:46.769102"], ["current_sign_in_at", "2015-04-14 16:55:46.769102"], ["last_sign_in_ip", "::1/128"], ["current_sign_in_ip", "::1/128"], ["sign_in_count", 1], ["updated_at", "2015-04-14 16:55:46.771162"], ["id", 5] COMMIT
(0.4ms) BEGIN
Payola::Subscription Exists (0.6ms) SELECT 1 AS one FROM "payola_subscriptions" WHERE "payola_subscriptions"."guid" IS NULL LIMIT 1
(0.2ms) ROLLBACK
(0.3ms) BEGIN
Plan Exists (0.4ms) SELECT 1 AS one FROM "plans" WHERE ("plans"."stripe_id" = ‘bronze' AND "plans"."id" != 3) LIMIT 1
(0.3ms) COMMIT
Completed 400 Bad Request in 193ms (Views: 0.9ms | ActiveRecord: 15.2ms)

Mark

On Apr 14, 2015, at 2:47 AM, Daniel Kehoe <notifications@github.com mailto:notifications@github.com> wrote:

I haven't been able to reproduce this issue using the version of the app in the GitHub repo (with Ruby 2.2.0 and Rails 4.2.1). I saw this issue briefly in development when I was using an unreliable Internet connection. I assumed it was a failure to connect with Stripe. Can we identify conditions needed to reproduce this issue?


Reply to this email directly or view it on GitHub #116 (comment).

Is the error consistent or intermittent? Does it fail always or just sometimes?

In development, what do you see in the Developer Tools Network tab? Are all the external scripts loading? In the Developer Tools Console are there any errors?

The error is consistent. The credit card submission on signup has never worked.

Everything in the network tab is green until I click the signup button. Then I get this in the Tools Console Network, Users Headers:

Remote Address:[::1]:3000
Request URL:http://localhost:3000/users
Request Method:POST
Status Code:400 Bad Request
Response Headersview source
Cache-Control:no-cache
Connection:Keep-Alive
Content-Length:95
Content-Type:application/json; charset=utf-8
Date:Wed, 15 Apr 2015 06:09:09 GMT
Server:WEBrick/1.3.1 (Ruby/2.2.0/2014-12-25)
Set-Cookie:request_method=POST; path=/
Set-Cookie:hgsub_session=dGt3R2U0MFNEYzJXLzNVQ21rcWJ6MDN2MmJNOUx5dVlFWUJTY3FiV0JnN--etc; path=/; HttpOnly
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-Request-Id:26622ce4-b492-44f0-b167-3e4774dbe639
X-Runtime:0.373086
X-Xss-Protection:1; mode=block
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,
/_;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:261
Content-Type:application/x-www-form-urlencoded
Cookie:_rails-stripe-membership-saas_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWQyNzA5MzBlNDRkNmFkOGM4NzQyZmM3etc
_hgsub_session=RHo4L1liQW9ZVG5Nd3pvdW5RS3FCSkgxUVN2dEF5TkZYOVVNM0dkN3o0VThCV-etc
Host:localhost:3000
Origin:http://localhost:3000
Referer:http://localhost:3000/users/sign_up?plan=bronze
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36
Form Dataview sourceview URL encoded
utf8:✓
authenticity_token:CR/bC0TOd2AA39HZno4ndjmfYNLJlbAYBr2pfq2S6zLEJy1emQBa4hCWNiz+jStzRP4wynAaWQ5tudRhMJs/bQ==
user[plan_id]:3
user[email]:myemail@gmail.com
user[password]:changeme
user[password_confirmation]:changeme

Users Preview:

error: "Email can't be blank and Stripe token can't be blank"
guid: null

status: "pending"

Users Response:

{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank"}

Users Timing:

On Apr 14, 2015, at 10:05 PM, Daniel Kehoe notifications@github.com wrote:

Is the error consistent or intermittent? Does it fail always or just sometimes?

In development, what do you see in the Developer Tools Network tab? Are all the external scripts loading? In the Developer Tools Console are there any errors?


Reply to this email directly or view it on GitHub #116 (comment).

Clearly the error handling is inadequate for the app and we'll have to improve it.

Right now I'm interested in why you're getting a failure that I can't reproduce. Can we rule out any issues with the local configuration of your Stripe public key, etc.? You could try the rails-stripe-coupons app and see if it works.

@dxypher can you give us an update? Did you find the source of the error? Did you resolve the issue?

This morning I got the "rails-stripe-membership" app to work one time randomly. Then it failed eight times in a row during various times of the day trying different things like restarting the server or my laptop, etc.

I also installed a new rvm folder with new Ruby 2.2.0 and Rails 4.2 and later Rails 4.2.1 and installed the "rails-stripe-membership" app there and it failed every time again. I uploaded this new version to heroku and it failed every time there too.

Next I downloaded a complete composer download of the “rails-stripe-coupons" app into the same new rvm Ruby 2.2.0 and Rails 4.2.1 setup. I tried purchasing with this app using all the same Stripe keys as my other failed apps and it worked every time during the day. I tried it six times and it worked every time.
.

I’m an amateur in terms of troubleshooting, but I have learned a few things already from this experience so far. My hunch is that the problem has to do with the Payola-payments gem since we weren’t using that in the coupon app .

Mark

On Apr 14, 2015, at 11:49 PM, Daniel Kehoe notifications@github.com wrote:

Clearly the error handling is inadequate for the app and we'll have to improve it.

Right now I'm interested in why you're getting a failure that I can't reproduce. Can we rule out any issues with the local configuration of your Stripe public key, etc.? You could try the rails-stripe-coupons https://github.com/RailsApps/rails-stripe-coupons app and see if it works.

@dxypher https://github.com/dxypher can you give us an update? Did you find the source of the error? Did you resolve the issue?


Reply to this email directly or view it on GitHub #116 (comment).

I also asked Stripe about the error I was getting.
Stripe support said:

"As for your error it looks like you are not retrieving the card token and email address properly and instead sending empty data. You'd need to make sure that you have some correct values before trying to create a customer or a charge."

On Apr 15, 2015, at 4:50 PM, Russon Mark markrusson1@gmail.com wrote:

This morning I got the "rails-stripe-membership" app to work one time randomly. Then it failed eight times in a row during various times of the day trying different things like restarting the server or my laptop, etc.

I also installed a new rvm folder with new Ruby 2.2.0 and Rails 4.2 and later Rails 4.2.1 and installed the "rails-stripe-membership" app there and it failed every time again. I uploaded this new version to heroku and it failed every time there too.

Next I downloaded a complete composer download of the “rails-stripe-coupons" app into the same new rvm Ruby 2.2.0 and Rails 4.2.1 setup. I tried purchasing with this app using all the same Stripe keys as my other failed apps and it worked every time during the day. I tried it six times and it worked every time.
.

I’m an amateur in terms of troubleshooting, but I have learned a few things already from this experience so far. My hunch is that the problem has to do with the Payola-payments gem since we weren’t using that in the coupon app .

Mark

On Apr 14, 2015, at 11:49 PM, Daniel Kehoe <notifications@github.com mailto:notifications@github.com> wrote:

Clearly the error handling is inadequate for the app and we'll have to improve it.

Right now I'm interested in why you're getting a failure that I can't reproduce. Can we rule out any issues with the local configuration of your Stripe public key, etc.? You could try the rails-stripe-coupons https://github.com/RailsApps/rails-stripe-coupons app and see if it works.

@dxypher https://github.com/dxypher can you give us an update? Did you find the source of the error? Did you resolve the issue?


Reply to this email directly or view it on GitHub #116 (comment).

@tmock12 suggests removing Turbolinks completely. I've merged his pull request. @mrusson please clone the current repo and try again and give us your report.

I've removed Turbolinks, and the payments now work... but when submitting a test CC number that should be declined, Stripe sends back an appropriate error message, but the user still gets created.

Even though your still on the subscription form and it appears that you haven't signed up, you can still go and sign in.

screen shot 2015-04-15 at 8 38 42 pm

I just cloned the app and this isn't working.
Here are the steps I've taken:

  1. git clone https://github.com/RailsApps/rails-stripe-membership-saas.git
  2. change ruby version in gemfile to ruby '2.1.3'
  3. bundle
  4. rake db:migrate
  5. rake db:seed
  6. rake secret
  7. change the secret.yml to have my api keys for stripe and new secret_key_base
  8. rails server and then sign up with valid test CC number

screen shot 2015-04-15 at 8 53 14 pm
screen shot 2015-04-15 at 8 53 54 pm

Retried with ruby 2.2.0 but same problem. This request just keeps getting called. I don't know if this screen shot helps:
screen shot 2015-04-15 at 9 37 06 pm

Ok, sorry about this. So when I cloned the repository and ran the app I never did...
rails g payola:install

After doing that I still get the 400 bad request error
screen shot 2015-04-15 at 9 59 42 pm

OK, my app is totally working now.

I tried it four times in dev mode and it worked every time. Then I uploaded the solution to heroku and ran it three times and it worked every time.

Here is what I did:
Removed turbolinks completely

Remove the gem 'turbolinks' line from your Gemfile.
Remove the //= require turbolinks from your app/assets/javascripts/application.js.
Remove the two "data-turbolinks-track" => true hash key/value pairs from your app/views/layouts/application.html.erb.
bundle install
-Make sure you save all the changes to git
-restart the server

Then try it.

I did not clone the new repo, I used what I had originally.
I did not roll back my ruby version. I stayed with ruby 2.2.0 and rails 4.2.0

In the credit card submission I used the 4242424242424242 test number. Everything confirmed and I looked in the Stripe dashboard and logs and it was all there.

I’ll check everything again in the morning to make sure I wasn’t dreaming. lol

On Apr 15, 2015, at 8:02 PM, Daniel Kehoe notifications@github.com wrote:

@tmock12 https://github.com/tmock12 suggests removing Turbolinks completely. I've merged his pull request. @mrusson https://github.com/mrusson please clone the current repo and try again and give us your report.


Reply to this email directly or view it on GitHub #116 (comment).

I'm still good on both my dev and heroku versions. So the complete removal of turbolinks solved the problem as far as I was concerned.

One other observation.
When the app was not working and I was getting this error:
"{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”},
a weakness I discovered in the app was that even though no purchase was made and not even a connection to the Stripe server had taken place, the app still created the new user and also gave them access to the download page of the digital product.

@mrusson I also saw this locally with the user being created.

The app (built from the tutorial) generally works after removing the turbolinks.

The app cloned from github however, I can't get working. Here's a screenshot of the error I'm getting.
screen shot 2015-04-16 at 6 11 45 am

Looks like the undefined method 'cards' is a known issue with the Payola gem.
payolapayments/payola#96

One other observation. 
When the app was not working and I was getting this error:
"{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”},
a weakness I discovered in the app was that even though no purchase was made and not even a connection to the Stripe server had taken place, the app still created the new user and also gave them access to the download page of the digital product.

@mrusson I also noticed that issue. We need to get the tests passing around signup, and then we can start to deal with the bugs like that one mentioned and get tests around them. I'm hoping to have some time this weekend and during RailsConf next week.

@dxypher thanks for the note on removing turbolinks that got it going for me!

@dxypher @mrusson @tmock12 @joesaundersak @DanielKehoe : Regarding he changes and tests now in place at PR Testsformaster #150 . I invite you to pull this branch into your working app, and take it for a spin. The four pending tests are related to this issue, Issue #116. I believe the problem I ran into is the same, in terms of not knowing how to get the stripe_token into the payola processings. Please note, the Stripe tests do not address payola's actions in any way. I leave that for others to play with. The rails-stripe-membership-saas app is priceless, this is my effort to get it tested. Any and all help is appreciated.

I want to thank you all for this thread. It definitely helped me troubleshoot an issue I had related to this, while not @dxypher's exact problem.

For me, this error was being displayed because I accidentally removed the yield(:head) from my layout template. Without this, the Payola gem's "payola/transactions/stripe_header" wasn't being included when referenced in "views/devise/registrations/new.html.erb". This is important because this include is what adds the references to the stripe v2 javascript. I was able to validate that this wasn't being loaded using the network tab of the chrome developer tools.

This meant that submitting a Sign Up request would create the user, but not generate the stripe subscription and stripe token needed to register a subscription for that user. Based on the current error handling, this causes it to output the JSON error above - because the stripe token was actually NULL. If you're seeing this error, double check that the stripe JS is actually loading.

Hope that helps :)

Thanks for tips to remove turbolink and now I don't have a problem with card number but raise me an error with expiration month/year is invalid.

So just in case anyone else finds this issue and has made the same mistake I have.

The cause of the error: "{"guid":null,"status":"pending","error":"Email can't be blank and Stripe token can't be blank”}
Is that the data that is passed to the Payola checkout renderer isn't being then forwarded onto Stripe.
This happens for example if //= require payola is removed from your application.js or equivalent.

If the Payola javascript lib isn't loaded correctly on that page then it won't pull the data attributes from the FORM object in the HTML and send that data to Stripe, which means email, token, etc are missing.

I hope this helps anyone else find their issue. 🙏🏻