Where Dynamicity Meets the Cloud

How To Use The Amazon FPS API Provided in Typica?

October 28th, 2008 by jeje, posted in Uncategorized

As part of Elastic Grid effort to provide an Amazon FPS webapp console, we’ve contributed an Amazon FPS API into Typica. The rationale for this, is first that we really like Typica, and second that we do consider the Java API provided by Amazon to be poorly designed and to stick to much to the underlying SOAP/Query APIs.

What we (Elastic Grid team) were in need of is a better Java API, and especially one masking the underlying complexity of the FPS API. So, we designed it in such a way that for most usages, some defaults are assumed and don’t need to be given each time you make a call.

For example, most of the FPS calls do need a caller token (a token identifying the participant making the call to FPS). Why should you give this parameter each time you need to call FPS? Instead we choose an approach where you (as a developer) specify the defaults for the caller and recipient tokens.

If you are in need of using advanced FPS features, you’ll still be able to use the FPS support in Typica because we also provide alternative calls in which you specify all parameters.

With that being said, let’s move to a quick introduction on how to use FPS support from Typica. First of all, you need to checkout Typica from Subversion and build it (because the FPS support is not yet officially released).

First of all you need to initialize the FPS service by giving it at least the credentials and ideally the default tokens. You also need to specify the server URL and CBUI pipeline URL (if you want to use the Sandbox instead of the default production mode):
[code language="java"]
FlexiblePaymentsService fps = new FlexiblePaymentsService(awsCredentials.getAccessId(), awsCredentials.getSecretKey(),
true, defaultCallerTokenID, defaultRecipientTokenID, defaultDescriptorPolicy, awsCredentials.getServerURL(), awsCredentials.getCBUI());
[/code]
If you don’t have any default value for the tokens, then for all the other FPS calls, you’ll have to use the methods allowing you to specify the value at the time you make a call to the API. If you gave the default values, then you won’t have to give them anymore.

If you want to retreive the account activity, it’s actually really simple:
[code language="java"]
AccountActivity activity = fps.getAccountActivity(fromDate);
[/code]
You also have other alternatives allowing you to select activity between two dates, filter by operation type, payment method, etc. The JavaDocs are you friend as we put as much comments as possible.

Now if you want to install a Single Use Token on your sender account, you simply need to do this:
[code language="java"]
String cbuiPipelineUrl = fps.acquireSingleUseToken("Reference of my order", new Amount(17.45, Amount.USD), "http://myserver/mycallback", "this is the reason why I'm asking for a payment");
[/code]

After your sender go through the CBUI pipeline, he will have an installed token in his account, and the CBUI pipeline will redirect him to the above callback URL. At that point, you’re supposed to verify the AWS signature (in order to make sure it’s the CBUI pipeline making a call and not a hacker) and extract the relevant information from the URL parameters:
[code language="java"]
String singleUseToken = fps.extractSingleUseTokenFromCBUI(requestGlobals.getHTTPServletRequest());
[/code]

When you are ready to effectively bill the user using this token, you simply need to do the following call:
[code language="java"]
Transaction txn = fps.pay(singleUseToken, new Amount(amount, Amount.USD), "Reference of my order");
[/code]
Of course, you can bill up to the amount you asked for at the time the user went through the CBUI pipeline.

We hope this really quick overview will help you start using FPS.


sexy myspace iconslabrador myspace layoutcop myspace graphicglitter icons for myspacebulletin survey for myspacethree days grace myspace backgroundmyspace slipknot layoutstop rated myspace layoutfree myspace birthday graphicsmyspace valentine layoutsdamaged days myspacekylie minogue myspace backgroundsfree frog myspace graphicswidgets for myspace pagesghetto myspace layoutdecorating myspace picturesmiley cyrus\'s myspacelucien facebooklove myspace bulletinsnaruto layouts for myspacerise against myspace layoutnickelback myspace layoutmyspace slippagedancing objects for myspacehide age on myspace profilescooby doo myspace layoutstim mcgraw myspace layoutsmyspace mps playersmyspace top 8 friends surveymyspace cowboy layoutsthe unit theme myspacemyspace birthday layoutsex pistols layout myspacemyspace profile search tweaksalyssa milano myspace pagememorial day comments for myspacelayouts planet myspacepagan myspace layouttrivium myspace layoutsjezzabel facebookcool myspace quizzesbratz myspace layoutsnhl myspace layoutsmyspace layouts rockstarfacebook gift coupon codemariah carey myspace layoutmyspace thermometer codemyspace jamee shavermyspace free layout and luggagemyspace anberlin graphicspoker palace myspacekfc myspace layoutsflower myspace backgroundsmyspace page trackercustom myspace cursorsbbw myspacemyspace layout overlaydirty myspace surveysmyspace funny christmas commentsfacebook dragon wars hintsword graphics for myspaceit\'s a girl myspace layoutsecstacy myspacespacing on myspace profilemartini myspace layoutslilly allen\'s myspaceladybug layouts for myspacesister in law myspace comments3d myspace backgroundsmyspace music player skinclaire dames myspace70 s myspace layoutsmyspace lyrics scrollermyspace university sports layoutsskateboarding myspace stuffpicture cube slideshow myspacemyspace secret trackersmyspace contact boardsmotorcross myspace layoutsinvisible myspace counterbulletins to post on myspacemyspace layouts trucksdefault myspace layout custommyspace easter graphics and commentskorn myspacebadass myspace layoutmyspace happy bunny codes commentsspongebob square pants myspace graphicsrach myspacemichael meyers myspace codesmyspace unique graphicsmyspace layout celtic80s myspace layoutaunt myspace commentssexy waterfall myspace graphicsmyspace backgrounds codestattoo myspace graphicsflipping text in facebookmyspace girl nudenext generation myspace layouts

Eco Technology

Elastic Grid, LLC. has adopted as a mantra the idea that any viable business can be done while helping others. So Elastic Grid, LLC. commits to give a percentage of all its benefits for non-profits organizations. Additionally Elastic Grid products will enable users to easily give extra money to those organizations and provide discounts to our customers helping them.

We Can Help

Our cloud-computing services can help you in your next project. Contact Us