Recurring billing with Rails - what are my options?

前端 未结 3 697
既然无缘
既然无缘 2021-02-02 00:50

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

The two I know of are using ActiveMerchant, or the paypal_recurring

3条回答
  •  臣服心动
    2021-02-02 01:29

    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.

    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.

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

    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.

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

    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.

提交回复
热议问题