So I have my PHP IPN script working, now I am just not sure how to get the post values? Paypal returns the post as an array like this.
transaction[0].is_primary_receiver=false
&transaction[0].id_for_sender_txn=50E02759CC687801U
&log_default_shipping_address_in_transaction=false
&transaction[0].receiver=xxxxxxxxxx@gmail.com
&action_type=PAY
&transaction[1].status=Completed
There is obviously more but you get the idea, I tried accessing the post for status like this.
$payment_status = $_POST['transaction'][1]['status']
but this doesn't work, it returns the first letter which is C. So how do I access the values for all of them.
With a little search I've found this link to be helpfull: https://developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/
The most relevant part of the page:
// Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
// Instead, read raw POST data from the input stream.
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode ('=', $keyval);
if (count($keyval) == 2)
$myPost[$keyval[0]] = urldecode($keyval[1]);
}