Amazon Flexible Payment System (FPS) library for Bungee Connect

Ever since the first time I heard about the new Amazon FPS service I have been anxious to integrate it into a web application. When I was tasked with creating a few use cases for Bungee Connect Amazon FPS was at the top of my list of services to use.

The tricky part about using FPS is signing each of the requests to the service. Amazon has made it easy for a few languages by providing a library to sign the requests. I decided to do the same for Bungee Connect. I cheated a little and just opened the Java and PHP libraries provided by Amazon and re-created the functionality in Bungee Logic.

For this use case I am using REST, so I made a wrapper around the api. I made a function for each REST call that has an input with all the params you might want and the response returned by the service. Because Bungee is object-based, for each response we take the XML and convert it to a Bungee object. To make handling both the requests and responses easier I imported the WSDL for FPS to automatically create all the types for both the responses and requests. Even though this library uses REST, all the types created during the WSDL import made it much easier to build this library. Normally I would have used SOAP, but Amazon uses WSSE and Bungee doesn’t have a predictable way for me to use the body in signing the request. However, the feature has been added to the roadmap and will be available in future releases.

While the WSDL had most of the types I needed, I had to add a couple to work with the Co-Branded UI Pipeline. To authenticate users, the app must send them to Amazon.com to sign in and authorize the app to charge them. Amazon calls this process the FPS Co-Branded UI Pipeline. Depending on the type of financial arrangement (prepaid, postpaid, etc.) you have to construct the request differently, so I added a type for the prepaid and postpaid requests and the subsequent responses. I also added a function for each to construct the URL to redirect customers to for the prepaid and postpaid pipelines. Note: I’ll be adding functions to create urls for multi-use and single-use pipelines in future versions.

Because everything is written in Bungee Logic you can inspect what I have done and even change it if you don’t like the way things are implemented.

The Amazon FPS team was extremely responsive and helpful in building this library. Development always goes much smoother when you have an engaged service provider.

Now that I have the library done, my use case will be much easier to build. I plan to release an early version very soon.

Hopefully this will make it easier for you to use FPS as well. If you want to use this library just import it from the “Example code” area on the home tab. Read the notes on the fpsApi class for a few steps to set it up. Let me know if you have any comments or questions.

If you would like to try this library, but don’t have a Bungee Connect account sign up here.

-Brad

About these ads

4 Comments »

  1. Hey Brad,

    Glad to see you’ve made progress on this! For reasons beyond the obvious we need to sync up on this ASAP! Will be in contact on Monday to start pushing things forward. Will provide extended info at that point.

  2. Thanks M. David. I’ll get in touch by email.

  3. PuReWebDev said

    Good stuff about the library. Amazon is definitely friendly to developers. I’ve built a few things with Amazon myself.

    I haven’t explored the fps service as yet, but I imagine that it’s as easy to use as their e-commerce service especially if you are using the rest protocol.

    thanks,
    PuReWebDev

  4. [...] Amazon FPS library for Bungee Connect Wrapper of the Amazon Flexible Payment System library for Bungee Connect developer tools. This post [...]

RSS feed for comments on this post · TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: