Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Braintree Hosted Fields Example

I am trying to get my head round the Hosted Fields framework of Braintree. It has been released just a few days ago and is still in beta.

I looked at the docs. I'm getting the overall idea but it would be nice to have some sort of small working example to start with. I found a github repo but the code does not seem to be working.

Google search did not deliver anything of value (just articles commenting on the idea). Can you point me to a working example (preferably one using rails) ?

like image 723
Nick Avatar asked May 19 '15 22:05

Nick


People also ask

What are Braintree hosted fields?

Hosted Fields is a way to accept credit card payments securely using our JavaScript SDK, while staying in control of the style of your desktop and mobile website checkout UI.

What are hosted fields?

Hosted Fields are prebuilt but customizable fields that accept customer card data, from which a single-use token is created to use as payment instead of the sensitive data. The token can then be stored so that the non-sensitive data can be reused, making future purchases easier for your customers.


1 Answers

I work at Braintree and was one of the developers on the Hosted Fields team. Glad to see so many people using it!

I made a GitHub repo that should answer your question. Basically, you have to set up Braintree on the server, create a client token, and then pass that client token to braintree.setup in the JavaScript.

The bulk of the Hosted Fields work happens in the "new transaction" view.

Hope this helps!

like image 192
Evan Hahn Avatar answered Oct 14 '22 19:10

Evan Hahn