使用带条纹设计的Ruby on Rails的订阅 [英] Using Stripe with Devise for Ruby on Rails Subscriptions

查看:178
本文介绍了使用带条纹设计的Ruby on Rails的订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图条纹的定期付款系统设计集成,采用瑞恩最近Railscast作为指导(的 http://railscasts.com/episodes/288-billing-with-stripe?view=asciicast )。

I am attempting to integrate Stripe's recurring payment system with Devise, using Ryan's recent Railscast as a guide ( http://railscasts.com/episodes/288-billing-with-stripe?view=asciicast ).

相反订阅模式,我想用我现有的用户模型。我过去加入条纹键,添加表单字段/用户/ sign_up,添加js和meta标签的头,我已经创造了资产users.js.coffee文件。

Instead of a Subscription model, I want to use my existing User model. I got past adding the Stripe keys, adding the form fields to /users/sign_up, adding the js and meta tag in the head, and I have created a users.js.coffee file in assets.

当我提交表单,我没有得到任何错误,而且任何提交给无条锈类型的反馈。记录显示从事物的认购方什么都没有。相反,我只是得到与设计创建了一个用户。

When I submit the form, I get no error, and no type of feedback that anything was submitted to Stripe. Logs show nothing at all from the subscription side of things. Instead, I just get a user created with Devise.

我缺少或文件的哪一步任何想法,我命名不正确?

Any idea what step I'm missing or which file I've named incorrectly?

谢谢,
--mark

Thanks, --Mark

推荐答案

我敢打赌,你不加载的jQuery。该subscriptions.js(或.coffee)要求的jQuery,但雷恩假定知识是在他的铁轨投隐含的。

My bet is that you're not loading jQuery. The subscriptions.js(or .coffee) requires jQuery, but Ryan assumes that knowledge is implicit in his rails cast.

编辑:刚刚已经解决了同样的问题,我本人曾在subscriptions.js与HTML表单的name属性而不是取代#new_subscription的简单问题。因此,举例来说,如果你的HTML如下:

Having just solved the same problem myself I had the simple issue of not replacing #new_subscription in subscriptions.js with the html form name attribute. So for example if your html looks like:

<form accept-charset="UTF-8" action="/plans" class="new_plan" id="new_plan" method="post">

那么你可以使用,而不是#new_subscription #new_plan。

Then you would use #new_plan instead of #new_subscription.

如果你不使用正确的格式名的jQuery不会'劫持'(触发回调)的形式提交按钮,让轨道处理表单前将数据发送到条纹。

If you don't use the proper form name jQuery won't 'hijack'(trigger the callback on) the form submit button to send data to stripe before letting rails process the form.

希望这有助于!

这篇关于使用带条纹设计的Ruby on Rails的订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆