Braintree Gateway w/ Spree 0.40.0

77 views
Skip to first unread message

Paul K

unread,
Jan 11, 2011, 4:44:22 PM1/11/11
to Spree
Does anyone have the Braintree gateway working with the latest version
of Spree? I'm looking to implement this but figured I'd ping the
community before trying to do this on my own.

Any help or pointers would be fantastic.

Thanks!

-Paul

Tim Case

unread,
Jan 11, 2011, 10:39:26 PM1/11/11
to Spree
+1 on this question, I just noticed that it's not a part of Spree core
in edge, is there a reason for this?

Sean Schofield

unread,
Jan 11, 2011, 10:46:27 PM1/11/11
to spree...@googlegroups.com
Its not intentionally left out but perhaps we didn't get around to
migrating it. We're not using Braintree (yet) but I'm interested in
trying it out and the Braintree guys helped out with the previous
implementation. If someone wanted to take the lead on restoring it
I'm sure the Braintree guys would help and we'd pitch in as well.

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

On Tue, Jan 11, 2011 at 10:39 PM, Tim Case <tcra...@gmail.com> wrote:
> +1 on this question, I just noticed that it's not a part of Spree core
> in edge, is there a reason for this?
>

> --
> You received this message because you are subscribed to the Google Groups "Spree" group.
> To post to this group, send email to spree...@googlegroups.com.
> To unsubscribe from this group, send email to spree-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/spree-user?hl=en.
>
>

Paul K

unread,
Jan 12, 2011, 9:03:26 AM1/12/11
to Spree
I gave them a call and they said it works with 0.11x

It seems like the implementation should not be too bad but I'm still
ramping up on my Ruby and Rails skills. It would also be a shame to
use Authorize.net CIM, IMO.

I'd be willing to take the lead on interfacing with the Braintree
guys. I'm a small customers of theirs at this point so if we could
round up a few more interested parties I think they'd be more
motivated to make this happen.

Anyone else out there interested in using Braintree as a gateway +
their Vault service (stores customer/card data)? To find a merchant
account I'd recommend checking out http://feefighters.com/

Thanks!

Paul Hinze

unread,
Jan 12, 2011, 11:21:32 AM1/12/11
to Spree
Hi Folks,

It's great to see interest in Braintree on this list. I've been
meaning to look into migrating support for our gateway over to the
latest branch of Spree, and based on interest here I'll bump up the
priority.

Give me a chance to work on this over the next week or so, and I'll
post here with updates on my progress.

Paul Hinze
Braintree Developer

On Jan 12, 8:03 am, Paul K <kaud...@gmail.com> wrote:
> I gave them a call and they said it works with 0.11x
>
> It seems like the implementation should not be too bad but I'm still
> ramping up on my Ruby and Rails skills. It would also be a shame to
> use Authorize.net CIM, IMO.
>
> I'd be willing to take the lead on interfacing with the Braintree
> guys. I'm a small customers of theirs at this point so if we could
> round up a few more interested parties I think they'd be more
> motivated to make this happen.
>
> Anyone else out there interested in using Braintree as a gateway +
> their Vault service (stores customer/card data)? To find a merchant
> account I'd recommend checking outhttp://feefighters.com/

Paul K

unread,
Jan 12, 2011, 12:07:56 PM1/12/11
to Spree
Hey Paul,

That's fantastic. Thank you very much. Please let me know if there's
anything I can do to help.

I think you guys would get a fair amount of business by being an
official "supported gateway" for spree and listed on this page:
http://spreecommerce.com/documentation/payment_gateways.html

Thanks again!
-Paul Kauders

Tim Case

unread,
Jan 12, 2011, 12:38:45 PM1/12/11
to Spree
My clients need this right away so I opened a ticket and I'm working
on it.

http://railsdog.lighthouseapp.com/projects/31096/tickets/1820-restore-braintree-support#ticket-1820-1

Looks like Braintree left a nice set of tests to work with so this
might not be so bad...

Sean Schofield

unread,
Jan 12, 2011, 1:32:40 PM1/12/11
to spree...@googlegroups.com
Tim,

Make sure you also open a GH pull request when the patch is done.
That's actually the first place I go when I have some spare moments.
LH is good but so many random issues and complaints (but not patches)
that GH makes sense for prioritizing (since we put greater priority on
issues with patches than those that do not have them.)

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

Tim Case

unread,
Jan 12, 2011, 3:27:56 PM1/12/11
to Spree
Okay, I'll open a GH pull request as well...

Paul Hinze

unread,
Jan 12, 2011, 5:03:13 PM1/12/11
to Spree
On Jan 12, 11:38 am, Tim Case <tcrai...@gmail.com> wrote:
> My clients need this right away so I opened a ticket and I'm working
> on it.

Sounds great. (I pinged Tim off-list to offer any help I might be able
to provide as he works on this.)

Sean Schofield

unread,
Jan 12, 2011, 11:05:59 PM1/12/11
to spree...@googlegroups.com
Cool. You guys might also want to add something about Braintree
specific considerations to the documentation.

http://spreecommerce.com/documentation/payment_gateways.html


Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

Tim Case

unread,
Jan 14, 2011, 12:57:47 PM1/14/11
to Spree

Sean Schofield

unread,
Jan 14, 2011, 1:32:18 PM1/14/11
to spree...@googlegroups.com
Tim,

There might be an issue with braintree gem (separate from this.) Can
you hop in #spree for a sec and ping me there?

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

On Fri, Jan 14, 2011 at 12:57 PM, Tim Case <tcra...@gmail.com> wrote:
> Pull request sent:
>
> https://github.com/railsdog/spree/pull/149

Tim Case

unread,
Jan 14, 2011, 4:28:50 PM1/14/11
to Spree
Hi Sean I looked for you on irc but I guess you had just left. Let me
know what the issue on the braintree gem might be.

Cheers,

Tim Case
t...@powerupdev.com

Sean Schofield

unread,
Jan 14, 2011, 4:39:35 PM1/14/11
to spree...@googlegroups.com
False alarm. Just a general Rubygems issue.

Paul K

unread,
Jan 21, 2011, 11:10:11 AM1/21/11
to Spree
Hey Guys,

Thanks again for your work on this.

I have been able to get the braintree gateway working with ruby 1.9.2,
and a new spree site using the 'braintree-support' branch.

For the braintree sandbox it works with test mode checked, 'test' as
the server, and sandbox credentials.

For production it works with test mode checked, 'live' as the server,
and real gateway credentials.

Under both scenarios customer card information is stored in the
braintree vault which is exactly what we need for our business.

I'm not sure if these are the best settings to use but it seems to be
working for me on Heroku with git://github.com/amedse/spree-heroku.git'
and sendgrid to send mail.

Thanks so much!

-Paul

ScotterC

unread,
Jan 27, 2011, 5:41:56 PM1/27/11
to Spree
Any news on the integration?

Just wanted to say I'm also interested.

Carlos Silva

unread,
Feb 11, 2011, 10:50:27 PM2/11/11
to Spree
Any idea when the braintree branch will be merged back to trunk?

On Jan 27, 2:41 pm, ScotterC <carleton.sc...@gmail.com> wrote:
> Any news on the integration?
>
> Just wanted to say I'm also interested.
>
> On Jan 21, 11:10 am, Paul K <kaud...@gmail.com> wrote:
>
> > Hey Guys,
>
> > Thanks again for your work on this.
>
> > I have been able to get thebraintreegateway working with ruby 1.9.2,
> > and a new spree site using the 'braintree-support' branch.
>
> > For thebraintreesandbox it works with test mode checked, 'test' as
> > the server, and sandbox credentials.
>
> > For production it works with test mode checked, 'live' as the server,
> > and real gateway credentials.
>
> > Under both scenarios customer card information is stored in the
> >braintreevault which is exactly what we need for our business.

Sean Schofield

unread,
Feb 13, 2011, 3:31:37 PM2/13/11
to spree...@googlegroups.com
It was merged a long time ago[1]. Have you tried the latest edge? We
should probably delete that branch (assuming everything was merged
into master properly and you can verify.)

Sean Schofield

[1] https://github.com/spree/spree/commit/1b1ccf58f771bf60c626e41a9c49ac67fc7331c1

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

Carlos Silva

unread,
Feb 13, 2011, 10:20:31 PM2/13/11
to Spree
Yes it was merged, I guess out of the box support for braintree would
be in 0.50.x?

On Feb 13, 12:31 pm, Sean Schofield <s...@railsdog.com> wrote:
> It was merged a long time ago[1].  Have you tried the latest edge?  We
> should probably delete that branch (assuming everything was merged
> into master properly and you can verify.)
>
> Sean Schofield
>
> [1]https://github.com/spree/spree/commit/1b1ccf58f771bf60c626e41a9c49ac6...
>
> -------------------------------------------
> Rails Dog LLC
> 2 Wisconsin Circle, Suite 700
> Chevy Chase, MD 20815
> voice: (301)560-2000
> -------------------------------------------
>
> On Fri, Feb 11, 2011 at 10:50 PM, Carlos Silva
>

Carlos Silva

unread,
Feb 14, 2011, 12:07:45 AM2/14/11
to Spree
Seems like braintree works with edge, the only problem I found was
that I could not void a payment through spree.

Sean Schofield

unread,
Feb 14, 2011, 10:25:03 PM2/14/11
to spree...@googlegroups.com
> Yes it was merged, I guess out of the box support for braintree would
> be in 0.50.x?

Yes. Along with everything else in the edge (master.) Of course we
reserve the right to pull stuff out of the edge before release if its
causing major problems but that's not something you'd have to worry
about in this case.

Sean Schofield

unread,
Feb 14, 2011, 10:26:29 PM2/14/11
to spree...@googlegroups.com
> Seems like braintree works with edge, the only problem I found was
> that I could not void a payment through spree.

I'll let the Braintree guys handle that one (or Tim Case who
contributed the recent patch.) We're not using Braintree atm (but
we're anxious to try it.) The Braintree guys have been eager to help
in the past though so maybe they will read this thread and help.

Sean

Sean Schofield

unread,
Feb 16, 2011, 5:26:33 PM2/16/11
to spree...@googlegroups.com
OK there seems to be a problem with void in general. I fixed it in
edge[1]. Can you please verify it works for you? I tested against
regular authorize.net (no CIM) and it worked fine.

Sean Schofield

[1] https://github.com/spree/spree/commit/deb438e470ee5823c769ab6a70f27fec19d59c1b

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

Carlos Silva

unread,
Feb 17, 2011, 10:47:16 PM2/17/11
to Spree
Void is still not working with edge. After doing a void through the
admin interface with the Gateway::Braintree as payment method in
Development it shows Braintree::NotFoundError, perhaps void is not
supported in Development environment. Here are the interesting pieces
from the logs:
...
/core/lib/spree_core/railtie.rb:24: warning: toplevel constant
Braintree referenced by Gateway::Braintree
Error registering gateway Braintree: undefined method `register' for
Braintree:Module
Started POST "/admin/orders/R360176641/payments/3/fire?e=void" for
127.0.0.1 at 2011-02-17 18:57:28 -0800
...
Gateway Error
--- !ruby/object:ActiveMerchant::Billing::Response
authorization:
avs_result:
code:
message:
street_match:
postal_match:
cvv_result:
code:
message:
fraud_review:
message: Braintree::NotFoundError
params: {}

success: false
test: false

On Feb 16, 2:26 pm, Sean Schofield <s...@railsdog.com> wrote:
> OK there seems to be a problem with void in general.  I fixed it in
> edge[1].  Can you please verify it works for you?  I tested against
> regular authorize.net (no CIM) and it worked fine.
>
> Sean Schofield
>
> [1]https://github.com/spree/spree/commit/deb438e470ee5823c769ab6a70f27fe...
>
> -------------------------------------------
> Rails Dog LLC
> 2 Wisconsin Circle, Suite 700
> Chevy Chase, MD 20815
> voice: (301)560-2000
> -------------------------------------------
>

Sean Schofield

unread,
Feb 18, 2011, 9:01:23 AM2/18/11
to spree...@googlegroups.com
You should contact Braintree then and see what they say. We'll be
happy to work with them to resolve it if there's something we can do
on this end.

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

ScotterC

unread,
Feb 22, 2011, 6:17:56 PM2/22/11
to Spree
What's the best way to get the Braintree working in 0.40.3? I have
the gateway model, I've added it to the spree_core in the library but
it's saying that 'register' is undefined. I can't move to edge spree
because it conflicts with too much of my code base.

Any help here would be appreciated.

On Feb 16, 5:26 pm, Sean Schofield <s...@railsdog.com> wrote:
> OK there seems to be a problem with void in general.  I fixed it in
> edge[1].  Can you please verify it works for you?  I tested against
> regular authorize.net (no CIM) and it worked fine.
>
> Sean Schofield
>
> [1]https://github.com/spree/spree/commit/deb438e470ee5823c769ab6a70f27fe...

ScotterC

unread,
Feb 23, 2011, 11:08:51 AM2/23/11
to Spree
Got it to register. Seemed to be a conflict with the Braintree gem
which was causing spree to look for a module and not a gateway.

Carlos Silva

unread,
Feb 25, 2011, 11:21:10 PM2/25/11
to Spree
What did you do to fix it? Also is CIM working for you against
braintree?

On Feb 23, 8:08 am, ScotterC <carleton.sc...@gmail.com> wrote:
> Got it to register.  Seemed to be a conflict with theBraintreegem
> which was causing spree to look for a module and not a gateway.
>
> On Feb 22, 6:17 pm, ScotterC <carleton.sc...@gmail.com> wrote:
>
> > What's the best way to get theBraintreeworking in 0.40.3?  I have
> > the gateway model, I've added it to the spree_core in the library but
> > it's saying that 'register' is undefined.  I can't move to edge spree
> > because it conflicts with too much of my code base.
>
> > Any help here would be appreciated.
>
> > On Feb 16, 5:26 pm, Sean Schofield <s...@railsdog.com> wrote:
>
> > > OK there seems to be a problem with void in general.  I fixed it in
> > > edge[1].  Can you please verify it works for you?  I tested against
> > > regular authorize.net (noCIM) and it worked fine.
>
> > > Sean Schofield
>
> > > [1]https://github.com/spree/spree/commit/deb438e470ee5823c769ab6a70f27fe...
>
> > > -------------------------------------------
> > > Rails Dog LLC
> > > 2 Wisconsin Circle, Suite 700
> > > Chevy Chase, MD 20815
> > > voice: (301)560-2000
> > > -------------------------------------------
>
> > > On Mon, Feb 14, 2011 at 10:26 PM, Sean Schofield <s...@railsdog.com> wrote:
> > > >> Seems likebraintreeworks with edge, the only problem I found was
> > > >> that I could not void a payment through spree.
>
> > > > I'll let theBraintreeguys handle that one (or Tim Case who
> > > > contributed the recent patch.)  We're not usingBraintreeatm (but
> > > > we're anxious to try it.)  TheBraintreeguys have been eager to help

ScotterC

unread,
Feb 26, 2011, 2:08:26 PM2/26/11
to Spree
I spoke too soon. I'm actually just using Braintree to authorize the
cards and not charge so I switched CIM to false. (I'm using Recurly
to process payments as an intermediary between me and Braintree).

Locally, I fixed it by taking the braintree gem out of my gemfile, and
changing the spree_core.rb or railtie.rb in the edge version to
register braintree. Taking the Braintree gem out is what got the
environment to stop looking at Braintree::module and start looking for
the gateway.

However, in production I'm having the same issue of Braintree not
showing up and I can't seem to get it to register.

Ted C. Howard

unread,
Mar 28, 2011, 8:56:02 PM3/28/11
to Spree
Did you ever get any resolution on this. I'm trying to use braintree
in spree 0.50.0 and I keep getting this error in the console:

Error registering gateway Braintree: undefined method `register' for
Braintree:Module

--
Ted C. Howard

On Feb 26, 2:08 pm, ScotterC <carleton.sc...@gmail.com> wrote:
> I spoke too soon.  I'm actually just usingBraintreeto authorize the
> cards and not charge so I switched CIM to false.  (I'm using Recurly
> to process payments as an intermediary between me andBraintree).
>
> Locally, I fixed it by taking thebraintreegem out of my gemfile, and
> changing the spree_core.rb or railtie.rb in the edge version to
> registerbraintree.  Taking theBraintreegem out is what got the
> environment to stop looking atBraintree::module and start looking for

Sean Schofield

unread,
Mar 28, 2011, 9:19:46 PM3/28/11
to spree...@googlegroups.com
This sounds like a serious problem. I'll try to investigate but this
week is pretty crazy so if someone wants to post a pull request if
they figure it out I will try to look at that ASAP. If this is still
not resolved in a few days I'll try to dig into it.

Sean Schofield

-------------------------------------------
Rails Dog LLC
2 Wisconsin Circle, Suite 700
Chevy Chase, MD 20815
voice: (301)560-2000
-------------------------------------------

ScotterC

unread,
Mar 29, 2011, 3:58:23 PM3/29/11
to Spree
Ted,

The problem your having is you probably have the Braintree gem
installed and in your gem file. Take it out, bundle update, and try
again. A better error to have is undefined method 'register' for
Braintree:Gateway, not module

Ted Howard

unread,
Mar 29, 2011, 4:26:20 PM3/29/11
to spree...@googlegroups.com
Here's what I tried:

made sure braintree wasn't in my Gemfile (it wasn't)
gem uninstall braintree (uninstalled 2 versions of the gem)
bundle update

run the server, try to checkout, same result:

spree_core-0.50.0/lib/spree_core/railtie.rb:24: warning: toplevel constant Braintree referenced by Gateway::Braintree
Error registering gateway Braintree: undefined method `register' for Braintree:Module


files that mention braintree in my app: (grep -lir "braintree" *)
 - Gemfile.lock (looks like a dependency of activemerchant)
 - db/development.sqlite3
 - log/development.log


--
Ted C. Howard

ScotterC

unread,
Mar 31, 2011, 10:40:41 AM3/31/11
to Spree
Ted,
Just realized I was giving instructions based on Spree 0.40. I'm not
sure about 0.50. Once I upgrade I'll have a better idea.

Ted Howard

unread,
Apr 1, 2011, 11:42:12 AM4/1/11
to spree...@googlegroups.com
Ah.  I thought braintree support wasn't in 0.40, and that I had to upgrade to 0.50.

Thanks for the help.


--
Ted C. Howard

Ted Howard

unread,
Apr 2, 2011, 7:40:58 PM4/2/11
to spree...@googlegroups.com
I'm not sure how to run spree without the Braintree gem.  It seems to use it in the gateway implementation.

What I did was to rename Gateway::Braintree to Gateway::BraintreeGW (I couldn't think of anything better).  That does work.

I don't know if you're interested in a pull request for a hack like that, but I'm going forward with it in my store until a better alternative comes up.


--
Ted C. Howard
Reply all
Reply to author
Forward
0 new messages