ACH support with stripe plugin or example

162 views
Skip to first unread message

duby.s...@cottageindustries.build

unread,
Nov 18, 2017, 1:56:15 PM11/18/17
to Kill Bill users mailing-list
Hi,

Looking at the Ruby Stripe plugin, I can see credit card fields listed in 'Plugin properties', but not any reference to bank account information for ACH transfers. I've been looking at the Stripe documentation, from the first link on the killbill stripe plugin github, and have been referring to the api for ACH (payments section). 

Does the killbill stripe plugin include support for ACH payment methods?
Does anyone have experience adapting the plugin to include this feature?
Or would this plugin not be the place to integrate ACH with Stripe?

Thank you,
Savannah
Ronin Consulting 

Pierre-Alexandre Meyer

unread,
Nov 20, 2017, 4:02:11 AM11/20/17
to duby.s...@cottageindustries.build, Kill Bill users mailing-list
On Sat, Nov 18, 2017 at 6:56 PM, <duby.s...@cottageindustries.build> wrote:
Does the killbill stripe plugin include support for ACH payment methods?

Today, I don't believe so. However, it looks like a subsequent version of ActiveMerchant added support for it:


You would need to upgrade the plugin to use the newer version of the library. Then, passing cc_type=check when creating the payment method might do the trick (to be tested).

Does anyone have experience adapting the plugin to include this feature?
Or would this plugin not be the place to integrate ACH with Stripe?

We would gladly accept a PR to add support for ACH in this plugin -- I believe that use case has simply never come up before.

If you are interested in doing the work, these links will be useful:
Hope that helps,
 
--
Pierre

duby.s...@cottageindustries.build

unread,
Nov 22, 2017, 5:09:20 PM11/22/17
to Kill Bill users mailing-list
Hello Pierre,

We actually have a dev on our team who's looking at the possibility of raising that pr. Thanks for the resources there.

I was kind of surprised to hear that using stripe ACH with KillBill has never come up. Are Dwolla or forte more commonly used for ACH integration these days? I noticed that the forte plugin code had not changed in a while. Is this still being actively integrated by new KillBill consumers?

Thanks for your help giving some clarity here.
Best,
Savannah

On Monday, November 20, 2017 at 3:02:11 AM UTC-6, Pierre-Alexandre Meyer wrote:

Pierre-Alexandre Meyer

unread,
Nov 23, 2017, 5:32:55 AM11/23/17
to duby.s...@cottageindustries.build, Kill Bill users mailing-list
Hi Savannah,

On Wed, Nov 22, 2017 at 10:09 PM, <duby.s...@cottageindustries.build> wrote:
We actually have a dev on our team who's looking at the possibility of raising that pr. Thanks for the resources there.

Great! Let him know to use the mailing-list in case he needs further guidance or help.

I was kind of surprised to hear that using stripe ACH with KillBill has never come up.

I should rephrase that: using Stripe ACH with the *open-source* Stripe plugin has never come up before. A lot of users run their own proprietary forks of the plugins and the changes don't always make it back to the open-source repositories unfortunately (I can think of two companies on top of my head who made their own custom changes to the Stripe plugin for instance).

Are Dwolla or forte more commonly used for ACH integration these days?

Most gateways support ACH nowadays (Vantiv, Adyen, Payeezy, etc.). Choosing a provider boils down to figuring out your needs (e.g. Dwolla for speed) and how to leverage your existing relationships (e.g. to optimize your costs).
 
I noticed that the forte plugin code had not changed in a while. Is this still being actively integrated by new KillBill consumers?

We don't always have visibility into which gateways are more populars than others, but we actively maintain all plugins under the GitHub killbill organization. Keep in mind also that gateway APIs are very stable and backward compatible over very long periods of time. The Litle (now Vantiv) plugin for instance has barely changed over the past few years despite being in production since 2013.

If you need a new feature in one of these plugins (e.g. Stripe ACH), always happy to review PRs!

Cheers,

--
Pierre

Andrew Ritchie

unread,
Nov 28, 2017, 7:57:23 AM11/28/17
to Kill Bill users mailing-list
Hi all,

I'm the developer working on this with Savannah. Do you have a recommended high level approach for adding ACH support that you would accept as a PR? Or could you recommend a starting point?

I spent some time reading through the code base for the Kill Bill Stripe plugin and at a glance the code seems rather dependent on the assumption of using a credit card.

I can think of a few ways to approach adding ACH support but if the goal is to submit a PR, and I like the idea of contributing to the open source projects we use, it seems like coordinating a bit would be helpful.

cheers,
Andrew

Pierre-Alexandre Meyer

unread,
Nov 28, 2017, 10:15:07 AM11/28/17
to Andrew Ritchie, Kill Bill users mailing-list
Hi Andrew,

Thank you for reaching out first. Agreed, coordinating on a general approach is a good idea, it's also going to make the code review easier on us.

The first decision we have to make is how to add ACH support to the ActiveMerchant Stripe client itself. There are two paths: we can either use a more recent version of the ActiveMerchant library which supports ACH (https://github.com/activemerchant/active_merchant/commit/f2a7ea3ed298038529acce7552b733ade8f3bc90) or backport support by Monkey Patching ActiveMerchant in the plugin (we are already doing this in the Stripe plugin, see https://github.com/killbill/killbill-stripe-plugin/blob/master/lib/stripe/ext/active_merchant/active_merchant.rb as well as in other plugins like CyberSource for instance: https://github.com/killbill/killbill-cybersource-plugin/blob/master/lib/cybersource/ext/active_merchant/active_merchant.rb).

I highly suspect route #2 is easier and is what I would do (we've diverged from ActiveMerchant over the years anyways and made the decision to not to keep up with upstream). If you would like to experiment with route #1 instead, you'll need to upgrade the dependency (https://github.com/killbill/killbill-stripe-plugin/blob/2efa097e9fdf72fa4d8135dba6082ca96e22ac93/killbill-stripe.gemspec#L36) as well as configure your Kill Bill instance to start a Ruby 2.0 compatible runtime (org.killbill.jruby.context.version=RUBY2_0). This might have side effects (we almost always run a 1.9 runtime), so testing will be key here.

Once this is done, I believe only one call needs to be wired properly: store (i.e. add payment method in Kill Bill). Purchase will works like any other credit card through tokens. To do so, passing the plugin properties bank_name, account_number and routing_number should create a Billing::Check object that is passed to ActiveMerchant, instead of a Billing::CreditCard (https://github.com/killbill/killbill-plugin-framework-ruby/blob/4681bfb8caafda0b3192ce368cb2e2e12cb17659/lib/killbill/helpers/active_merchant/payment_plugin.rb#L468 will need to be updated).

So, in a nutshell:
  • Update the client in the plugin to support Stripe checks
  • Update the base framework gem to support ActiveMerchant checks
There are lots of tests already in the plugin (https://github.com/killbill/killbill-stripe-plugin/tree/master/spec/stripe/remote), which don't require a Kill Bill instance. I suggest adding a couple more to test your new code. Make them pass first, and only then try a manual end-to-end scenario through Kill Bill.

Let me know if that makes sense,

--
You received this message because you are subscribed to the Google Groups "Kill Bill users mailing-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-users+unsubscribe@googlegroups.com.
To post to this group, send email to killbilling-users@googlegroups.com.
Visit this group at https://groups.google.com/group/killbilling-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/killbilling-users/fc41df88-4f95-4acf-a5d2-394abe809c39%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Pierre

Andrew Ritchie

unread,
Dec 1, 2017, 11:26:07 AM12/1/17
to Kill Bill users mailing-list
Hi again Pierre,

I got to a point where I'd added some code and would like to run some tests but then I noticed that even before my changes the existing tests don't pass. There's an error regarding passing credit card numbers directly to Stripe. I created a github gist with the logs. Is this something I should worry about as far as my development environment being setup incorrectly or otherwise or should I just worry about writing tests that pass for my use cases?


thanks,
Andrew
To unsubscribe from this group and stop receiving emails from it, send an email to killbilling-us...@googlegroups.com.
To post to this group, send email to killbill...@googlegroups.com.



--
Pierre

Pierre-Alexandre Meyer

unread,
Dec 1, 2017, 12:31:49 PM12/1/17
to Andrew Ritchie, Kill Bill users mailing-list
On Fri, Dec 1, 2017 at 4:26 PM, Andrew Ritchie <ritc...@gmail.com> wrote:
I got to a point where I'd added some code and would like to run some tests but then I noticed that even before my changes the existing tests don't pass.

The latest Travis run is green (mostly -- the one failure is due to an OpenJDK bug): https://travis-ci.org/killbill/killbill-stripe-plugin/builds/228369099.

I'm wondering if it's related to the Stripe API version. Which API version are you testing against? The plugin is compatible with the 2015-02-18 one.

I created a github gist with the logs. Is this something I should worry about as far as my development environment being setup incorrectly or otherwise or should I just worry about writing tests that pass for my use cases?

I think we should first make sure the tests are passing in your environment, adapting the code or the tests as needed.

Could you try switching the test card number to a token as suggested in the docs (e.g. tok_visa)?

--
Pierre

Andrew Ritchie

unread,
Dec 4, 2017, 7:59:16 AM12/4/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
I'm testing against the most recent Stripe API version. I set up a new account to generate API keys. 

According to Stripe's docs each account has an API version that is set on your first transaction.

Are you saying the plugin may not be compatible with more recent versions of the Stripe API? Do you know of anyone using it in production with recent Stripe API versions?

As far as switching the test card number to a token, I'm not sure where I would start with that:

The error is happening in add_payment_method within the killbill ruby gem. It's called via "super" in /lib/stripe/api.rb:115 in killbill-stripe-plugin

It seems that the existing code & tests are based on the assumption that a card number can be sent to Stripe (right now it uses a test card number 4242 4242 4242 4242). Unless I'm misunderstanding something sending a token instead would be a major change.

This is the request that gets the error from the Stripe API:


It looks as though Stripe made a major API change and requires CC info to be tokenized through one of their front end libraries and no longer supports adding cards in the manner the plugin is designed to operate:


What do you think? I'm I looking at this correctly? Is there a workaround I'm missing?

thanks,
Andrew
--

Andrew Ritchie

unread,
Dec 4, 2017, 2:56:25 PM12/4/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Quick update:

After digging through the libraries, I found I can actually send a token instead of the card details by changing the arguments to create_payment_method,


I can include the token and override including a full CC number in the API request.

It looks like the API change that corresponds to this may be here: https://stripe.com/docs/upgrades#2015-10-12

It's a little vague but it seems as though full CC numbers are considered invalid parameters by Stripe as of 2015-10-12.

Hopefully I can proceed from here but if you have any additional wisdom to pass along definitely chip in.

thanks!
-Andrew

Pierre-Alexandre Meyer

unread,
Dec 5, 2017, 6:37:17 AM12/5/17
to Andrew Ritchie, Kill Bill users mailing-list
On Mon, Dec 4, 2017 at 7:56 PM, Andrew Ritchie <ritc...@gmail.com> wrote:
After digging through the libraries, I found I can actually send a token instead of the card details by changing the arguments to create_payment_method,


I can include the token and override including a full CC number in the API request.

Overriding the card number with a token sounds like a good approach. The Braintree plugin does something similar:


It's a little vague but it seems as though full CC numbers are considered invalid parameters by Stripe as of 2015-10-12.

Interesting - I am wondering if they now have special enterprise accounts for large companies using a different vault (in-house or vendor neutral).

Hopefully I can proceed from here but if you have any additional wisdom to pass along definitely chip in.

Looks like you are on the right path!

--
Pierre

Andrew Ritchie

unread,
Dec 5, 2017, 7:26:43 AM12/5/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Thanks! I've mostly dealt with the test failures, but there is one left that I'm not sure what to do about. Here's a gist:


It's the only test in killbill-stripe-plugin/spec/stripe/remote/connect_spec.rb:


The code looks to be creating an account then issuing a charge and refund. All my issues with the API and card tokenization have been resolved but this test is still failing at check_balance on line 118

Pierre-Alexandre Meyer

unread,
Dec 5, 2017, 9:39:24 AM12/5/17
to Andrew Ritchie, Kill Bill users mailing-list
On Tue, Dec 5, 2017 at 12:26 PM, Andrew Ritchie <ritc...@gmail.com> wrote:
The code looks to be creating an account then issuing a charge and refund. All my issues with the API and card tokenization have been resolved but this test is still failing at check_balance on line 118

IIRC that one test is flaky unfortunately, due to delays on the Stripe side. You can ignore it for now.

--
Pierre

Andrew Ritchie

unread,
Dec 12, 2017, 1:06:10 PM12/12/17
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Hey Pierre,

I have a first draft for an update to support ACH ready and I opened a pull request on Github. I'm not sure what next steps would be from here. Do you have any thoughts?

thanks,
Andrew

Pierre-Alexandre Meyer

unread,
Dec 13, 2017, 10:52:50 AM12/13/17
to Andrew Ritchie, Kill Bill users mailing-list
Thank you Andrew, we'll take a look and comment directly on the PR.

Cheers,
--
Pierre

Andrew Ritchie

unread,
Jan 4, 2018, 9:49:46 AM1/4/18
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
Hi Pierre,

Checking in again, did you ever have a chance to review my replies to your comments on the PR?

thanks,

 Andrew

Pierre-Alexandre Meyer

unread,
Jan 4, 2018, 10:03:38 AM1/4/18
to Andrew Ritchie, Kill Bill users mailing-list
Hi Andrew,

I didn't see any new update on the PR regarding what we've talked about (migrations, README, Ruby 2.0 syntax, BankAccount refactoring, etc.). Did you push new code?

Regarding the delay in the tests, did you reach out to Stripe already?
--
Pierre

Andrew Ritchie

unread,
Jan 4, 2018, 10:07:16 AM1/4/18
to Pierre-Alexandre Meyer, Kill Bill users mailing-list
I didn't push new code but I replied to some of your comments.

And no, I have not reached out to Stripe at all.

Pierre-Alexandre Meyer

unread,
Jan 4, 2018, 11:08:04 AM1/4/18
to Andrew Ritchie, Kill Bill users mailing-list
Sorry, I'm confused: is there any specific comment you need my input on? It sounds like all of the action items are on your end?
--
Pierre
Reply all
Reply to author
Forward
0 new messages