Amazon Flexible Payments Service
Advanced 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...

Handling Transactions that Don't Return

When a customer buys a product on your website, their expectation is that the product will be paid for and delivered, but sometimes problems cause service requests to become lost. In those cases, it is sometimes possible to find the lost transaction.

Co-Branded Service Requests that Don't Return

After the sender finishes the CBUI pages and authorizes the payment, the service should redirect the sender to the URL you specified in the returnURL parameter in the CBUI request. There might be times, however, when the sender authorizes the payment and the redirect fails. Because you don't have the SenderTokenId, you can't charge the sender for the authorized purchase. Use the following procedure when the redirect from service fails.

To recover the SenderTokenId

  1. Query your database to get the CallerReference you supplied in the Co-Branded service request for the transaction in question.

  2. Send a GetTokenByCaller request with the CallerReference.

  3. If there isn't an Errors element in the response, the sender authorized the payment but there was some problem with the redirect to returnURL. The response includes SenderTokenId.

    If there is an Errors element in the response, the authorization did not succeed.

Resending Requests

There are times when network problems prevent the completion of requests. This could happen both for Co-Branded service requests and for FPS API requests. Your application should periodically check for this condition, and if it occurs, retry the request.

Resending Co-Branded Service Requests

To check for Co-Branded service requests that didn't complete, whenever you send a request, put the caller reference value from the request in your database. When you get the response, store the token ID that your receive against the caller reference in your database.

About once each hour, resend any requests that don't have a sender token ID stored against the caller reference. The timing is important, because for most tokens, Amazon FPS maintains the token IDs for only three hours.

Resending Amazon FPS API Requests

Each time you send a request to the Amazon FPS API, FPS maintains the caller reference from the request for 7 days and uses it to check for duplicate requests. If you don't receive a response to an Amazon FPS API request, you can resend the exact same request within that seven-day period, and Amazon FPS will return the original response and not create a new transaction. If the first request succeeded, the second request does not charge the sender's payment instrument a second time.

In that seven-day period, if you send a request with that same caller reference value but other parameter values, Amazon FPS returns a DuplicateRequest error.

After the seven-day period, if you send the original request again (with the same caller reference and parameter values), Amazon FPS creates a new transaction.