使用 Rails 定期计费 - 我有哪些选择? [英] Recurring billing with Rails - what are my options?

查看:21
本文介绍了使用 Rails 定期计费 - 我有哪些选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开始之前,我想知道我所有的选择是什么,如果可能的话,它们的利弊.

Before jumping in I'd like to know what all of my options are, and, if possible their pros and cons.

我认识的两个正在使用 ActiveMerchant 或 paypal_recurring gem,但它们能满足这些要求吗?

The two I know of are using ActiveMerchant, or the paypal_recurring gem, but will they satisfy these requirements?

  • 能够适应按月和按年计费
  • 能够暂停、取消帐户等
  • 处理过时的卡详细信息或付款失败

paypal_recurring gem 的待办事项列表包括添加对 IPN 的支持" - 怎么会没有这种影响功能?

The to-do list for the paypal_recurring gem includes 'adding support for IPN' - how will not having this impact functionality?

我知道有 railskit SaaS,但我更愿意自己编写代码,因为 railskit 仍在 3.2.1 上.

I know there is the railskit SaaS but I'd rather code something myself as the railskit is still on 3.2.1.

我知道有 cheddergedder/chargify 等服务,但它们是否与您联系在一起?他们只有美国吗?它们是否值得考虑 - 还是它们通常只针对非开发人员?

I know there are services like cheddergedder/chargify etc, but do they tie you in? Are they US only? Are they worth considering - or are they usually just aimed at non-developers?

提前致谢.

推荐答案

我刚刚完成了这个,所以我会试着阐明你的选择.我最终通过 Paypal 使用 Paypal Express Checkout 进行所有经常性购买.我们有一个定制的循环计费设置,每月通过 Authnet 向客户的信用卡收费,但不得不切换,因为我们需要一个国际解决方案,而 Paypal 是唯一支持我们需要的货币的解决方案之一,而且编码并不完全是一场噩梦.

I just finished going through this, so I'll try to shed some light on your options. I ended up using Paypal Express Checkout for all recurring purchases through Paypal. We had a custom-rolled recurring billing setup that charges a customer's credit card monthly through Authnet, but had to switch because we needed an international solution, and Paypal was one of the only ones that supported the currencies we needed, and wasn't entirely a nightmare to code.

您可以通过 这个 插件,但请记住,它不是 ActiveMerchant 的正式组成部分,因此如果 ActiveMerchant 更改其处理某些事情的方式,则可能会中断.因此,我最终使用 paypal-recurring 通过 Paypal 处理通信,然后滚动我自己的 IPN 解析器,在 Railscasts 的帮助下.另一个对我有很大帮助的链接是 this,尽管所有:txn_type 值最终不同.

You can use ActiveMerchant for recurring billing with this plugin, though keep in mind that it is not officially a part of ActiveMerchant, and therefore is subject to break if ActiveMerchant changes how it handles certain things. Because of that, I ended up using the paypal-recurring to handle communication through Paypal, and then rolled my own IPN parser, with help from Railscasts. Another link that helped me a lot was this, though all the :txn_type values ended up being different.

关于最后一个链接,以下是我特别注意的 4 个 :txn_type:

With regards to that last link, here are the 4 :txn_types that I specifically watch out for:

  1. express_checkout - 第一次回发.
  2. recurring_payment_profile_created - 当用户第一次订阅时在第一次回发时发送.
  3. recurring_payment_profile_cancel - 当用户从 Paypal 的网站取消订阅时发送.
  4. recurring_payment - 款项已转入您的帐户.这就是我在每月续订之前所等待的.这篇文章还附带了payment_status,需要完成.
  1. express_checkout - first postback.
  2. recurring_payment_profile_created - sent on first postback when the user first subscribes.
  3. recurring_payment_profile_cancel - sent if user cancels subscription from Paypal's site.
  4. recurring_payment - Money has been transferred to your account. This is what I wait for before I renew their subscription on a monthly. This post also comes with payment_status, which needs to be completed.

您提到的其他事情,例如处理失败的付款和过期的卡,都是通过您的 Paypal 帐户处理的.

The other stuff you mentioned, like handling failed payments and out-of-date cards, is handled through your Paypal account.

提醒一下 - 我最终使用 Paypal 的唯一原因是因为它得到了普遍认可和信任,并且接受国际货币.他们的网站上有大量的文档,其中大部分都是多余的、令人困惑的,而且太长了.我的建议是确保您真的想要/需要处理经常性付款,因为它们很难正确实施,而且可能比它们的价值更麻烦.

Just a word of warning - the only reason I ended up using Paypal is because it is universally recognized and trusted, and it accepted international currencies. There is an enormous amount of documentation on their site, and most of it is redundant, confusing, and entirely too long. My recommendation is to make sure you really want/need to deal with recurring payments, as they are difficult to implement correctly and can be more trouble than they're worth.

这篇关于使用 Rails 定期计费 - 我有哪些选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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