# Amazon FPS PHP Library Ver-2008-09-17

## About this Library

- Based on the 2008-09-17 API version.
- Version 2.0
- Release Date : 2009-11-03

## Prerequisites

- Amazon FPS Sandbox Account (Click here to sign up).
- Amazon FPS Developer Account (Click here to sign up).

## Package Content

Directory | Overview
--- | ---
src | Source distribution of the library. All sources including code samples that demonstrate the use of the library located under this directory.

## Steps to make a sample (Refund) API call

- Open RefundSample.php in src/Amazon/FPS/Samples

- Set request parameters. For example, find following pre-generated snippet:

    // @TODO: set request. Action can be passed as Amazon_FPS_Model_RefundRequest
    // object or array of parameters
    // invokeRefund($service, $request);

- Uncomment third line and set Refund request parameters

    $request = new Amazon_FPS_Model_RefundRequest();
    $request->setTransactionId("YourOriginalTransactionIdForWhichYouWantTheRefund");
    $amount = new Amazon_FPS_Model_Amount();
    $amount->setCurrencyCode(CurrencyCode.USD);
    $amount->setValue("1");
    $request->setRefundAmount(amount);
    $request->setCallerReference("ABCDEFGHIJKL12345");
    $request->setCallerDescription("Ecommerce Merchant - FPSBuy.com");

- run sample. You should see the output similar to the following:

    RefundResponse
    	RefundResult
    		TransactionId
    			14GK6F2QU755ODS27SGHEURLKPG72Z54KMF
    		TransactionStatus
    			Pending
    	ResponseMetadata
    		RequestId
    			1a146b9a-b37b-4f5f-bda6-012a5b9e45c3:0

- Experiment with other samples, examine samples sources. When ready, add library project to your solution, and use it
- If the response status is Pending, you can use `GetTransactionStatus` API to get latest transaction status
- Use the samples in IPNAndReturnURLValidator package for validating and receiving IPNs for this refund transaction

## Related resources

More about Amazon FPS
Documentation
Code samples
Contact us for technical issues

## Comments, Questions or Feedback

If you have any comments, questions or feedback on the library, please start discussion here (Amazon FPS forum).