【发布时间】:2016-07-27 13:51:05
【问题描述】:
所以我有我的 rails 应用程序销售订阅以访问内容。我暂时在结帐表单中插入一个隐藏字段以将 tax_percent 传递给 Stripe 的 API,但它在 Stripe 仪表板中一直显示为 null。该税仅适用于新泽西州,如果买家也在新泽西州,则税率为 7%。我正在通过 javascript 调用 (Calculating Sales Tax for a US State in Javascript) 计算销售税,然后将值推送到 subscription#create 操作。除非它不起作用。
这是表格中的行的样子:
<input type="hidden" id="tax_percent" name="tax_percent">
<%= f.hidden_field :plan_id %>
是的,我需要在服务器端构建一个 Ruby 方法来计算它,但是现在,这很好。
以下是日志中显示的内容:
Processing by Koudoku::SubscriptionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"TokenValueHere", "tax_percent"=>"7", "subscription"=>{"plan_id"=>"5", "credit_card_token"=>"OtherTokenValue", "last_four"=>"undefined", "card_type"=>"undefined"}, "owner_id"=>"72"}
所以您看到 tax_percent 似乎在订阅对象之外,但 plan_id 不在,但它们在结帐表单中彼此相邻。
如何让这个 tax_percent 正确使用 Stripe API??
【问题讨论】:
标签: javascript ruby-on-rails stripe-payments