2015-06-06 117 views
1

我使用的是使用PayolaRails-Stripe-Membership-SaaS。 Payola假定您想要创建一个即时收费订阅。这意味着免费试用免费计划和计划需要在注册时使用信用卡。我想解决这个问题。我做了这里叉:https://github.com/archonic/payola使用Stripe on Rails免费订阅 - 无卡使用令牌

当我感到困惑的是如何完成的第一步这里的细节: Stripe - How to handle subscription with a free plan and no credit card required at sign up time

条纹不需要免费计划或计划用卡审判,但我不知道如何创建一个没有卡的令牌。在我致电create_customer之前,如何才能通过电子邮件获得令牌?

回答

2

您不需要令牌来创建客户。先走一步,这样调用的客户创造API:

customer = Stripe::Customer.create(
    email: "[email protected]", 
    description: "...something..." 
) 
# do something with customer, save id in db/etc 

您可以在客户订阅具有内无需卡贴免费试用计划。如果您想要,只要计划有免费试用,您甚至可以通过plan: 'someplan'创建客户电话。

+0

那简直太可笑了。试图让Payola在表单提交时不需要卡片,我需要更改提交处理程序。你知道我可以用什么来代替'Stripe.card.createToken'吗? – Archonic

+0

对于那个部分你根本不需要Stripe。直接提交表单(模糊地,我​​会看看createToken调用的响应处理程序中发生了什么,然后直接执行)。如果您将PayPal的实际前端代码指向我,我可能会提供更多帮助。 – rfunduk

+0

下面是响应处理程序:https://github.com/peterkeen/payola/blob/master/app/assets/javascripts/payola/subscription_form_twostep.js#L17 – Archonic

相关问题