I am using the GoCardless API to create a subscription. I have created it and now trying to show the payments in a table.
The API returns a stdClass Object with the upcoming payments in an array. How can I show these in a table?
$SUBS=$client->subscriptions()->get("$SUB");
Subscription Class
stdClass Object
(
[id] => SB00024BNFEEHX
[created_at] => 2020-03-07T20:20:05.025Z
[amount] => 5998
[currency] => GBP
[status] => active
[name] =>
[start_date] => 2020-03-12
[end_date] =>
[interval] => 1
[interval_unit] => monthly
[day_of_month] =>
[month] =>
[count] =>
[metadata] => stdClass Object
(
[subscription_number] =>
)
[payment_reference] =>
[upcoming_payments] => Array
(
[0] => stdClass Object
(
[charge_date] => 2020-03-12
[amount] => 5998
)
[1] => stdClass Object
(
[charge_date] => 2020-04-14
[amount] => 5998
)
[2] => stdClass Object
(
[charge_date] => 2020-05-12
[amount] => 5998
)
[3] => stdClass Object
(
[charge_date] => 2020-06-12
[amount] => 5998
)
From other questions I have tried
$array = json_decode(json_encode($SUBS),true);
echo"$array";
However this just displays/prints Array
You want to convert it an
objectasarrayso simple typecast will work