Get Instant Payment Notification (IPN) data into PHP VARIABLE


I am working with an API provided here to get IPN call back for payment or refund

With the code here:

$input = file_get_contents('php://input');
$json = @json_decode($input, true);

$secret = 'SECRETCODE';
$secret = substr(sha1($secret), 0, 32);

$notification = base64_decode($json['notification']);

$iv = base64_decode($json['iv']);

$decoded = openssl_decrypt(

$data = json_decode($decoded, true);

$trxntype = $data['transactionInfo']['transactionType'];
$paymethod = $data['transactionInfo']['paymentService'];
$f_name = $data['customerInfo']['contactInfo']['firstName'];
$l_name = $data['customerInfo']['contactInfo']['lastName'];

The $f_name and $l_name are correct!
But now, the $ trxntype and $paymethod returns NULL instead of the payment details.

How can I fix this?


Have you dumped the return object to see what is getting returned?

If the customer fields are there and the transaction details are not, it sounds like the transaction did not go through… Their documentation doesn’t mention anything about errors other than going into your account to check for them. So, contacting their support group may be what you need to do.


I did exactly that and found out that the variables I was not able to get returned NULL.
This issue has been resolved.
Thanks for your response.