| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Amazon provides five samples in four programming languages (C#, Java, Perl, and PHP) which show you how to build Co-Branded User Interface request URLs.
When you download a sample file, such as amazon-fps-2008-09-17-java-library, the folder contains sample classes showing how to generate pipeline-specific CBUI URLs from your code ([package root]/src/com/amazonaws/cbui/samples is the location you extracted your sample package).[package root]
Each sample describes its requirements in its Readme.html file, located at the package root. Typically, the entire library structure must be available to the compiler. For example, the amazon-fps-2008-09-17-php-library.zip file contains the src/Amazon/CBUI and folders which the files in src/Amazon/CBUI/Samples require.
In addition to these primary components, a sample may include other required resources. For example, the Java samples all include numerous jar files in the folder, which must also be in your classpath in order to compile the sample.[package-root]/third-party
For each sample, you must set your security credentials and Amazon FPS sandbox endpoints in a library-dependant way. For example, to use the C# library, you set your security credentials in the file, while for the perl library you set them in the individual [package-root]/src/Amazon.FPS.Samples/Amazon.FPS.Samples/AmazonFPSSamples.cs file you are working with. [package-root]/src/Amazon/CBUI/Samples/*.pl
The following samples are provided with each sample library:
|
Class |
Description |
|---|---|
|
|
Requests authorization for a one-time payment. |
CBUI Multi-Use Pipeline Sample
| Requests authorization for multiple payments. |
CBUI Recipient Pipeline Sample
| Requests authorization for a recipient token pipeline, such as that needed for marketplace fixed and variable fees. |
CBUI Recurring Token Pipeline Sample
| Requests authorization for a recurring token pipeline, such as that needed for periodic charges. |
|
|
Requests authorization for an edit-token pipeline. |
In the following section, we show how to work with the CBUI Single Use Pipeline sample using the Java library.
This sample enables you to set up a single-use token for a one-time payment.
You will find that the basic process you use for the CBUI Single Use Pipeline sample is the same for all the other samples in the CBUI/Samples (or, in the case of Amazon.CBUI.Samples) folder. (The process for the FPS and Return URL/IPN Validations samples are different. For more information, see Understanding the Amazon FPS Samples.)
This section describes the Java version of the CBUISingleUsePipeline. The files for the C#, Perl, and PHP CBUISingleUsePipeline samples are listed in Locations of the CBUISingleUsePipeline Files in Other Libraries
The CBUISingleUsePipeline sample centers on the following files:
|
File |
Description |
|---|---|
|
|
Set your AWS access key ID, AWS secret key, and sandbox endpoint in this file. Important Your Secret Access Key is a secret, which only you and Amazon should know. It is important to keep it confidential to protect your account. Store it securely. Never include it in your requests to the Amazon Flexible Payments Service (Amazon FPS), and never email it to anyone. Do not share it outside your organization, even if an inquiry appears to come from Amazon Web Services (AWS) or Amazon.com. No one who legitimately represents Amazon will ever ask you for your Secret Access Key. |
CBUISingleUsePipelineSample.java | In the main method, you create an AmazonFPSSingleUsePipeline object and use it to add parameters specific to your application. |
AmazonFPSSingleUsePipeline.java | Invoked from CBUISingleUsePipelineSample.java, this class contains the setMandatoryParameters and validateParameters functions which you can customize for your application. |
Co-Branded service request with Java SDK Sample
|
1 |
Open the file Important Your Secret Access Key is a secret, which only you and Amazon should know. It is important to keep it confidential to protect your account. Store it securely. Never include it in your requests to the Amazon Flexible Payments Service (Amazon FPS), and never email it to anyone. Do not share it outside your organization, even if an inquiry appears to come from Amazon Web Services (AWS) or Amazon.com. No one who legitimately represents Amazon will ever ask you for your Secret Access Key. To get your security credentials, see Getting an AWS Account in the Amazon Flexible Payments Service Getting Started Guide. |
|
2 |
In the same file, set the |
|
3 |
In the same file, set the |
|
4 |
Open the file AmazonFPSSingleUsePipeline pipeline= new AmazonFPSSingleUsePipeline(accessKey, secretKey); Change the //pipeline name, your return URL, and the amount
pipeline.setMandatoryParameters("callerReferenceSingleUse",
"
Save the file. |
|
5 |
Ensure that all the jar files in the |
|
6 |
Compile and run the sample. The Co-branded authorization page is printed to standard out. |
|
7 |
Using a web browser, navigate to the URL produced by the sample. Because the sender and recipient cannot be the same, you must use an account different from your AWS developer or business accounts. |
|
8 |
When complete, the page you specified as |
You can customize the sample by modifying the file . The [package-root]/src/com/amazonaws/cbui/AmazonFPSSingleUsePipeline.javasetMandatoryParameters only requires callerReference, returnUrl, and transactionAmount. If you want to make more parameters mandatory, modify this method.
In the same file, the validateParameters function ensures that the transactionAmount parameter is present. You can add custom validation checks to this method.