私は Paypal Adaptive Payments を使用しており、IPN リスナーからパラメーターを読み取ろうとしていますが、それほど単純ではありません。まず第一に、これは私の IPN リスナーです:
<?php
/**
* This is a sample implementation of an IPN listener
* that uses the SDK's PPIPNMessage class to process IPNs
*
* This sample simply validates the incoming IPN message
* and logs IPN variables. In a real application, you will
* validate the IPN and initiate some action based on the
* incoming IPN variables.
*/
require_once("paypal/samples/PPBootStrap.php");
$ipnMessage = new PPIPNMessage();
foreach($ipnMessage->getRawData() as $key => $value) {
error_log("IPN: $key => $value");
}
if($ipnMessage->validate()) {
error_log("Success: Got valid IPN data");
$receiver_email = $_POST['transaction[0].amount']; //DOES NOT WORK
//THIS TWO PARAMETERS ARE OK
$payment_status = $_POST['status'];
$sender_email = $_POST['sender_email'];
} else {
error_log("Error: Got invalid IPN data");
}
?>
status と sender_email は正しく読み取られますが、その奇妙な transaction[0].mount は未定義のインデックス エラーを返します! それが transaction%5B0%5D.amount として渡されたことは知っていますが、文字列を置き換えようとしても同じエラーが返されます!