Jump to content
christogonus

Get Instant Payment Notification (IPN) data into PHP VARIABLE

Recommended Posts

I am working with an API provided here http://ipndoc.paydotcom.com/ 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(
$notification,
'AES-256-CBC',
$secret,
OPENSSL_RAW_DATA,
$iv
);

$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?

Share this post


Link to post
Share on other sites

First step is to logs the contents of $data somewhere so you can look at what is in it.

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.