Amazon Simple Pay: PHP Library for "Settle\Refund" APIs and REST

Sample Code & Libraries>Amazon FPS>Amazon Simple Pay: PHP Library for "Settle\Refund" APIs and REST
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

You can use the sample code in this SDK to make refund and settle API calls in conjunction with Amazon Simple Pay.

Details

Submitted By: Abhay@AWS
AWS Products Used: Amazon FPS
Language(s): PHP
License: Apache License 2.0
Created On: May 15, 2008 9:16 AM GMT
Last Updated: September 22, 2010 5:52 PM GMT
Download

Release Date: 2008-05-13

Summary

You can use the sample code in this SDK to make refund and settle API calls in conjunction with PayNow Widgets. Please read https://payments.amazon.com/sdui/sdui/business?sn=paynow/whatispaynow

Prerequisites

Software / Utility Version or Other information Available at
PHP version 5.2.6 http://www.php.net/downloads.php

Setup

  • Extract the contents of amazon-fps-paynow-2008-05-01-php-library.zip to a folder. A directory named amazon- fps-paynow-2008-05-01-php-library will be created. This folder will be referred to as <Library_Root> from this point onwards Within the <Library_Root> directory you will see "src" directory. The src directory contains all the src files for php required to run the samp le code
  • Before you make Settle request, you should have already made successful reserve request using Amazon Payments Pay Now widget. Please use the transaction -id returned by the reserve request with this Settle API call
  • Before you make Refund request, you should have already made successful Payment or Settle request using Amazon Payments Pay Now widget. Please use the transaction-id returned by the reserve request with this Settle API call

Configuration

  1. Download and install the following softwares.
    1. http://www.php.net/downloads.php
    2. Add PHP to your system path
  2. Update the keys required to make the API call. This is one time activity and should be same for all APIs
    1. Goto <Library_Root>/src/Amazon/FPS/Samples directory
    2. Open the .config.inc.php file
    3. Change the following two lines and save the file.
      1. define('AWS_ACCESS_KEY_ID', '');
      2. define('AWS_SECRET_ACCESS_KEY', '');
  3. Update the FPS endpoint
    1. Goto <Library_Root>/src/Amazon/FPS directory
    2. Open the Client.php file
    3. Change the following line and save the file
        a. private $_config = array ('ServiceURL' ='<fps endpoint>');

Steps to Run the Sample

  1. Settle the transaction using sample code
    1. Open SettleSample.php in <Library_Root>/src/Amazon/FPS/Samples directory
    2. Change the following line
      1. $request->setTransactionId(''); //set the transaction Id here
      2. $amount->setValue();//set the amount here
    3. Run "php SettleSample.php" to make the settle API call
  2. Refund the transaction using sample code
    1. Open RefundSample.php in <Library_Root>/src/Amazon/FPS/Samples directory
    2. Change the following lines
      1. $request->setTransactionId(''); //set the transaction Id here
      2. $request->setRefundTransactionReference('');
      3. $request->setTransactionDescription('chargeback, need for refund');//description for the refund
      4. $amount = new Amazon_FPS_Model_Amount();
      5. $amount->setCurrencyCode('USD');
      6. $amount->setValue();
      7. $request->setRefundAmount($amount);
    3. Run "php RefundSample.php" to make the refund API call
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.