Getting started with the Buxter Java API

Feb 10, 2010

So you have a great product and you want to bill your customers purchasing items on your web application in a way that is convenient and easy to do. In this article we are going to get you started with the Buxter java api.

1. Prerequisites

Since we will be using a snapshot of the Buxter Java API client to , we will need a few things to get started on our project

2. Linking all the nuts and bolts

First we will need to build the client library. The buxter java client is currently maintained at the project site located at http://code.google.com/p/buxter-api/.

Let's create a directory into which we will download the api client and check out the actual client source code. like so:

mkdir buxter
cd buxter
svn checkout http://buxter-api.googlecode.com/svn/trunk/ buxter-api-read-only

Now we need maven to compile the libraries we need.

cd buxter-api-read-only/
mvn package
mvn install

This will cause maven to download all Buxter client dependencies and create the .jar files. When it is ready, it will greet you with a "BUILD SUCCESSFUL" message, which means you have just created a working client module for Buxter.

3. Signup and configuration

If you haven't used Buxter before, you will have to sign up for the service first. This is done quite easily by logging into your Facebook account and visiting http://apps.facebook.com/buxtersandbox/ and accepting the TOS. 


Buxter-fb-application-tabAfter that, click on the "Applications" tab. This is the Place where you create the link between Buxter and your own application. 

When you click on the "Add" Button you will be able to enter your application details. This will be the base information Buxter will use to communicate with your application.

You will be shown the box below in which you can enter three parameters.


Bildschirmfoto 2010-02-10 um 13.26.05These parameters are quite straightforward. Your application name will be shown whenever someone buys an item from you to signal the customer to whom the payment will go to. 

Application url is the location to which the customer will be redirected after he has made or cancelled a purchase of an item. The underlying controller code of this url must be able to verify a few parameters that will be passed by buxter to verify if an item was purchased, but this is something we will discuss later on.

The Application Icon URL is a link to the icon you want to use as a brand element in the Buxter UI. It will lend your corporate identity to the transaction, though the entire handling is done on the Buxter side. This parameter is optional.


For demonstration purposes we will create an online kitten shop.

Bildschirmfoto 2010-02-10 um 13.26.30 As you can see on the image to the left, the kitten shop was successfully created. Also, Buxter created a set of parameters for us that are quite important.

API Configuration ID we will use this as the identifier to Buxter. The three parameters we entered when we created our application are stored under this configuration id.

Secret key this is the data that will be used later to calculate the security hashes that will secure the sales process.

Status is the status of the Buxter configuration of your application. On creation it is just "Created", you will have to click on "Activate" to enable the Buxter application to receive payments. This is basically a flag for development purposes, if you switched to active your payment configuration is now live.

4. Integrating Buxter payment to your web application

For the sake of briefness we prepared a small web application based that you can download here. It is based on the Stripes web framework. It's basically a web shop selling kitten images :)

Since this is a demo implementation, we are using the Buxter Sandbox instead of the real Buxter application. The sandbox uses sandbox money instead of real currency, which is assigned to developers at no cost.

CC-GNU LGPL This software is licensed as CC-GNU LGPL of Version 2.1 or higher. 

Download kittenshop.zip (2445.7K)

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Wow.... I have never heard about it. This program should be cool and useful!

The comments to this entry are closed.