Amazon Simple Pay
Advanced User Guide (API Version 2010-08-28)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

Working with Amazon Simple Pay Buttons

This section provides task-oriented descriptions of how to create Amazon Simple Pay buttons, and how to use and implement Amazon Flexible Payments Service (FPS) actions. For a description of Amazon FPS actions that are appropriate to use with Amazon Simple Pay, see the API Reference.

Common Amazon Simple Pay Tasks

The following table explains how you can find the information you need in this guide.

If you want to... Relevant Sections

Learn the basics of Amazon Simple Pay

Overview

Key concepts

Amazon Simple Pay Getting Started Guide

Learn how to create a signed button of any typeCreating Button Forms Dynamically
Modify the sample code to create a standard, donation, marketplace, or subscription buttonUnderstanding the Amazon Simple Pay Button Samples

Use the response and transaction content returned by your buttons and by Amazon Payments

Handling Return Content

Validate responses for the Return URL and Instant Payment Notification

Verifying the ReturnURL and IPN Notifications

Understand subscription button particulars

Working with Subscription Buttons

Use Amazon Flexible Payments Service actions available with Amazon Simple Pay

API Reference

Use Instant Payment Notification (IPN)

Using Instant Payment Notification, How to Verify the IPN Signature and Verifying the IPN

Settle or refund money

How to Settle and Refund Transactions Programmatically

Work with signatures

Creating Button Forms Dynamically, How to Generate a Signature, and About Signature Version 2.

Get sample code for signing buttons, verifying return data, and generating a button request

Appendix: Sample Code

Accepting Payments from Mobile Devices

Amazon FPS provides a seamless integration with web sites optimized for mobile devices. No special Amazon FPS coding is required. The software detects the client browser HTTP_USER_AGENT and routes the request along the appropriate CBUI pipeline. A separate pipeline is optimized for the mobile device experience.

Note

For optimal security, your mobile application should make use of a full browser instance (not a browser embedded within an application). It should display the browser address bar to enable customers to confirm the URL.

The user CBUI experience is managed for you. You handle all Amazon FPS requests, return URLs, and IPN notifications regardless of which client browser the customer is using.

Amazon Simple Pay makes it easy to test your mobile client experience. For more information, see Simulating a Mobile Client.

Testing Your Applications in the Amazon Payments Sandbox

The Amazon Simple Pay Getting Started Guide describes accessing the Amazon Payments business account sandbox and provides an overview of its features. For more information about the sandbox, go to https://payments-sandbox.amazon.com.

Amazon Payments Sandbox

With the Amazon Payments developer sandbox you can test the more advanced features of your button applications.

Note

You cannot port the code for the buttons you create in the sandbox to the production environment. When you are satisfied that your button works correctly in the sandbox, make careful notes and recreate it in the production environment. For best results, test the button again in the production environment.

The Amazon Payments developer sandbox enables you to try the following:

  • Use credit cards and bank accounts in your test transactions without any prior verification and without incurring charges.

  • Simulate certain errors, such as temporary declines, that could appear in a real transaction. This simulation can help you test the error handling capabilities in your application.

You can test the following user experiences in the sandbox:

  • View changes to the test account balance from test button operations you generate

  • Track the effects on your account balance of a series of transactions over time (you cannot, however adjust the sandbox dates, but you can track cumulative changes in your Account Activity Center).

  • View the transaction activity updates from test button operations you generate

The Amazon Simple Pay Getting Started Guide has instructions on testing basic button features using the Amazon Payments business sandbox.

Simulating a Mobile Client

You can easily test the CBUI pipeline that your customers experience when they use their mobile devices. Amazon Payments uses the value of the client browser's HTTP_USER_AGENT to route the request along the appropriate pipeline. If you set your development environment to report a value for HTTP_USER_AGENT reported by a mobile device, Amazon Payments will invoke the mobile pipeline.

For example, the following value simulates an Apple iPhone 3G version 2.1, with Safari 3.1.1:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_1 like Mac OS X; en-us) 
            AppleWebKit/525.18.1 (KHTML, like Gecko)
            Version/3.1.1.1 Mobile/5F136 Safari/525.20

Testing Button Signatures

You can easily test your signature creation code using any of the examples in Amazon Simple Pay Button Input Reference. Each example contains a signature calculated from the values in the rest of the example.

To test a signature

  1. Copy any one of the HTML examples in Amazon Simple Pay Button Input Reference.

  2. Remove the enclosing FORM element from your copy.

  3. Remove the Signature field and the HTML comments from your copy.

  4. Create a signature using the instructions in How to Generate a Signature

  5. Compare the output from your signature creation code with the value you removed from the HTML example. They should be identical.

Creating a Test Account Balance

When using the Amazon Payments developer sandbox, you can use a test account for payment simulations.

To create a test account balance

  1. Log in to http://payments-sandbox.amazon.com with your username and password.

  2. On the Your Account tab, click Add a Bank Account in the Enhance your account area.

  3. Provide following test information

    • Routing#: 123456789

    • Account#: 111122223333

    • Driver license: 123; WA

  4. Add the bank account

  5. On the Deposit tab, use the deposit form to add money to your account.

  6. Click the Your Account tab. Your balance will be displayed.

Forcing Error Conditions

In the Amazon Payments developer sandbox, you can force an error by placing certain decimal values in the amount. The following table details the values.

Force ConditionError ForcedSimulation
The amount includes a decimal value between .60 and .69Temporary DeclineOccurs when a downstream process is not available.
The amount includes a decimal value between .70 and .89.Payment ErrorInsufficient funds

Note

If you want your test transaction to be a success, avoid using amount values which contain decimal values between .60 and .89. For example, the following amounts all force errors: 0.61, 123.6522, 1.79. The following amounts do not force an error: 0.16, 123.56, 8.97.