0
<?php
/** 
 *  PHP Version 5
 *
 *  @category    Amazon
 *  @package     Amazon_FPS
 *  @copyright   Copyright 2008-2011 Amazon Technologies, Inc.
 *  @link        http://aws.amazon.com
 *  @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
 *  @version     2010-08-28
 */
/******************************************************************************* 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon FPS PHP5 Library
 *  Generated: Wed Sep 23 03:35:04 PDT 2009
 * 
 */

require_once '.config.inc.php';
require_once 'Amazon/IpnReturnUrlValidation/SignatureUtilsForOutbound.php';

class Amazon_FPS_IPNVerificationSampleCode {

    public static function test() {

        $utils = new Amazon_FPS_SignatureUtilsForOutbound();

        //Parameters present in ipn.
        $params["TransactionId"] = "17UD7UO16UVR84O88ZMHJ1QUMDE1GFETHOE";
        $params["TransactionDate"] = "1372686606";
        $params["Status"] = "SUCCESS";
        $params["NotificationType"] = "TransactionStatus";
        $params["CallerReference"] = "callerReference=ReferenceString51d18879000f4";
        $params["Operation"] = "PAY";
        $params["TransactionAmount"] = "USD 5.00";
        $params["BuyerName"] = "prabhnoor";
        $params["PaymentMethod"] = "CC";
        $params["PaymentReason"] = "DescriptionString-1251832057319108";
        $params["RecipientEmail"] = "zoccusmed@gmail.com";
        $params["SignatureMethod"] = "RSA-SHA1";
        $params["SignatureVersion"] = "2";
        $params["CertificateUrl"] = "https://fps.sandbox.amazonaws.com/certs/090911/PKICert.pem";
        $params["Signature"] = "Mmyahn7nFpOhYgg76orkNv88Psw4is3H9fHIC0VUdNA"
                               ."PaT81jGIKgLezCk/z2xSpacot3NzhGUw9"
                               ."f18nXR1dFSDItu2AHYEtcZ9efeEqo73H"
                               ."lQxG0ysnIOjuXTX3K2gqBlAFnVHTmcADTDUKHfceqm2H"
                               ."w8wf+oz+Er8zCY58uFw=";

        $urlEndPoint = "http://www.dekhfashion.com/testamazon/test/ipn/"; //Your url end point receiving the ipn.

        print "Verifying IPN signed using signature v2 ....\n";
        //IPN is sent as a http POST request and hence we specify POST as the http method.
        //Signature verification does not require your secret key
        print "Is signature correct: " . $utils->validateRequest($params, $urlEndPoint, "POST") . "\n";
    }
}

Amazon_FPS_IPNVerificationSampleCode::test(); 
?>

これにより無効な署名エラーが発生する場合

すべての変数の最初の文字を大文字にしてください....

4

1 に答える 1