I've a GET request in PHP that receives data in JSON as below.
{
"data": {
"id": "1cc58ad2-ccfd-4ede-a6a6-35809c81cb8a",
"type": "payment",
"attributes": {
"status": "Sent",
"created_at": "2022-05-02T08:57:50.171+03:00",
"amount": {
"currency": "KES",
"value": "500.0"
},
"transfer_batches": [{
"status": "Sent",
"amount": "500.0",
"disbursements": [{
"amount": "500.0",
"status": "Transferred",
"origination_time": "2022-05-02T08:57:50.171+03:00",
"transaction_reference": "1651471070",
"destination_type": "till",
"destination_reference": "3eccf0c1-ab6b-41a4-b51a-4e8f588105f1"
}]
}],
"metadata": {
"something": "TST-01",
"something_else": "Something else"
},
"_links": {
"callback_url": "http://portal.zarafu.com/payments",
"self": "https://sandbox.kopokopo.com/api/v1/payments/1cc58ad2-ccfd-4ede-a6a6-35809c81cb8a"
}
}
}
}
How can I filter the transaction_reference
and status
.
I have tried..
$jsonData = json_decode($response);
echo '<pre>';
echo $jsonData->status;
echo '</pre>';