Amazon Flexible Payments Service
Basic Quick Start (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...

Transacting the Payment

The sender uses the CBUI to authorize the payment. Upon the successful authorization, the CBUI redirects the sender to the URL specified by the returnURL parameter in the Co-Branded service request. When you parse this returned URI, you check the status parameter and returnURL , among other values. If the status is one of the success values, you need to send a request to start the purchase transaction. Other values included in the URI include a pointer to the token, called the SenderTokenId, stored on Amazon servers that contains the payment instructions and is used to actually make the money transfer. The URI also includes a CallerReferenceId, which is an ID the caller (developer) uses as a key for a table that contains transaction. The URI also includes a transaction ID, which identifies the transaction and can be used in API requests, such as Settle.

Amazon FPS provides two ways to charge the sender's payment instrument:

  • Pay—Immediately charges the sender's payment instrument, such as a credit card

    Pay can accept all payment instrument types, including credit card, bank account debit, and Amazon Payments withdrawal.

  • Reserve—Does not immediately charge the sender's credit card

    Instead, the total price of the purchase is reserved against the payment instrument. Reserve can only use a credit card payment instrument. To complete the purchase, you must subsequently issue a Settle request, which you usually do after you have fulfilled the order.

Process for Transacting a Payment Using Pay

1

Obtain the list of items the sender is purchasing from your website and derive the values required for the parameters in the Co-Branded service request.

One of the parameters is TransactionAmount. The value for this is the total charge to the sender, including tax, shipping and any other fees.

Another parameter is CallerReference. You generate this identifier and associate it with the payment instrument created. You can index the transactions on your database based on its value. This way, you can match the identifier on your database (CallerReference) to the identifier on the Amazon FPS database, TransactionId.

For more information about the parameters, see Single-Use Token API.

2

Implement on your website the equivalent of a Pay Now button so that it sends the Co-Branded service request. For more information, see Sending a Co-Branded Service Request.

When the sender authorizes the payment in the CBUI, the service then redirects the sender to the URL you specified in the returnURL parameter in the Co-Branded service request. This URL is typically a Thank you page and one that invites the sender to keep shopping.

3

Parse the returned URI.

In addition to the URL specified by returnURL, the URI contains parameters added by the Co-Branded service. Those parameters include all of the parameters in the Co-Branded service request, which are helpful for debugging purposes; a tokenId, which you must subsequently submit with the Pay (or Reserve) request; and a status, which tells you whether or not the sender successfully authorized the payment.

4

If the status value is a success value, programmatically submit a Pay request. For information about the action, see Pay.

The required parameters include SenderTokenId, which maps to the tokenId you received in the Co-Branded service response; TransactionAmount, which you entered in the Co-Branded service request; and the CallerReference.

Tip

Both the Co-Branded service API and the Amazon FPS API use a parameter called CallerReference. It's easier if you use the same value for both parameters. We recommend that you make the CallerReference the same as the order ID on your website.

5

Parse the response.

Two important values the Pay request returns are TransactionStatus, which tells whether the charge was successful against the sender's payment instrument; and TransactionId, which is the identifier Amazon Payments uses to identify this transaction. You should maintain the TransactionId in your database and associate it with your CallerReference value for the transaction.

6

Upon a successful transaction, add a task to your workflow to fulfill the order.