1

just tried several $result->key ($customer->transaction->status) but was not successful. i need the "status" value of this object in php. tried some combinations of array shift, ->object ->["status"] etc.

 object(stdClass)#2 (3) { ["customer"]=> object(stdClass)#3 (1) { ["link"]=> object(stdClass)#4 (3) { ["url"]=> string(78) "https://demo1.com" ["rel"]=> string(8) "customer" ["method"]=> string(3) "GET" } } ["transaction"]=> object(stdClass)#5 (9) { ["merchantRefId"]=> string(19) "46532156465456" ["amount"]=> int(200) ["currency"]=> string(3) "EUR" ["id"]=> string(15) "646544564564" ["transactionType"]=> string(27) "Transfer" ["createDate"]=> string(19) "2016-01-26 08:33:09" ["updateDate"]=> string(19) "2016-01-26 08:33:09" ["status"]=> string(8) "accepted" ["fees"]=> array(1) { [0]=> object(stdClass)#6 (3) { ["feeType"]=> string(11) "service_fee" ["feeAmount"]=> int(119) ["feeCurrency"]=> string(3) "EUR" } } } ["links"]=> array(1) { [0]=> object(stdClass)#7 (3) { ["url"]=> string(78) "https://demo.com" ["rel"]=> string(4) "self" ["method"]=> string(3) "GET" } } } 
2
  • What is the result of var_dump($customer->transaction);? Commented Jan 26, 2016 at 8:46
  • thx 4 help, problem solved Commented Jan 26, 2016 at 9:29

1 Answer 1

1

Since you didn't provide the code that creates your object, I've created JSON string and converted it to object, which gives similar var_dump result to yours.

<?php $jsonStr = '{ "customer": { "link": { "url": "https://demo1.com", "rel": "customer", "method": "GET" } }, "transaction": { "merchantRefId": "46532156465456", "amount": 200, "currency": "EUR", "id": "646544564564", "transactionType": "Transfer", "createDate": "2016-01-26 08:33:09", "updateDate": "2016-01-26 08:33:09", "status": "accepted", "fees": [ { "feeType": "service_fee", "feeAmount": 119, "feeCurrency": "EUR" } ] }, "links": [ { "url": "https://demo.com", "rel": "self", "method": "GET" } ] }'; $stdObj = json_decode($jsonStr); var_dump($stdObj); var_dump($stdObj->transaction->status); 

I am able, and you should be too, to simply get status with simple:

$customer->transaction->status 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.