1

I have this result from verified transaction:

 Array ( [status] => 1 [message] => OK [user_card_no] => 6037997445418040 [amount] => 10000 [refId] => 787225 ) 

this is the function:

include_once("functions.php");
$api_token = 'My_Api_Token';
$transId = $_POST['TransId'];
$result = verify($api_token,$transId);
$result = json_decode($result,true);
print_r($result);

I tried to echo each key and value with this way:

echo $result->status;

Here is my result:

Notice: Trying to get property 'status' of non-object in /home/skyw3b/domains/sky7bet99.com/public_html/pay/verify.php on line 17

3
  • 1
    Remove true from json_decode Commented Feb 4, 2020 at 8:40
  • 1
    if i remove true, I'll get this: stdClass Object ( [status] => 1 [message] => OK [user_card_no] => 6037997445418040 [amount] => 10000 [refId] => 787225 ) how can i use this one? Commented Feb 4, 2020 at 16:07
  • 1
    You can use same echo $result->status; Commented Feb 5, 2020 at 3:27

1 Answer 1

2

As you can see above $result is an Array and in PHP to get a key from array you have to use

$result['status']

as you have done with $_POST['TransId'];

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.