4 Replies - 276 Views - Last Post: 11 March 2019 - 05:24 AM Rate Topic: -----

#1 christogonus   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 10

Get POST data into PHP VARIABLE

Posted 09 March 2019 - 08:42 PM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: Get POST data into PHP VARIABLE

#2 andrewsw   User is online

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,045
  • Joined: 12-December 12

Re: Get POST data into PHP VARIABLE

Posted 09 March 2019 - 11:22 PM

A first step is to print $data and see what it contains.
Was This Post Helpful? 2
  • +
  • -

#3 christogonus   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 10

Re: Get POST data into PHP VARIABLE

Posted 11 March 2019 - 05:10 AM

View Postandrewsw, on 09 March 2019 - 11:22 PM, said:

A first step is to print $data and see what it contains.



Thanks a lot for your reply.

Since this is an IPN sent on the background that I can not view the printed page. How can I view the printed record?

Thank you once more.
Was This Post Helpful? 0
  • +
  • -

#4 christogonus   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 10

Re: Get POST data into PHP VARIABLE

Posted 11 March 2019 - 05:20 AM

View Postandrewsw, on 09 March 2019 - 11:22 PM, said:

A first step is to print $data and see what it contains.


Got it right now.

Thanks a lot!
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is online

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,045
  • Joined: 12-December 12

Re: Get POST data into PHP VARIABLE

Posted 11 March 2019 - 05:24 AM

I am glad you sorted.

It will be helpful to anyone encountering this topic if you briefly described what the issue and resolution were.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1