php - Getting Date from Subscription Data from Braintree Payments -
i'm missing obvious; i'm trying date returned data setting subscription braintree payments. code follows:
$result1 = braintree_subscription::create($subscriptiondata); if ($result1->success) { echo("subscription id: " . $result1->subscription->id . "<br />"); echo("transaction id: " . $result1->subscription->transactions[0]->id . "<br />"); echo("type: " . $result1->subscription->transactions[0]->amount . "<br />"); //next line has error!!!!!! echo("date: " . $result1->subscription->billingperiodenddate . "<br />"); the first 3 "echo's" return supposed without problem. if try , date value e.g: billingperiodenddate, billingperiodstartdate, createdat, updatedat page fails, (nothing more displayed) there no error. error reporting switched on. appreciated.
if remove line error , add following below
echo "<ul>"; foreach ($result1 $item) { echo "<li>" . $item . "</li>"; } then can see entire contents of array. still cannot pull bit need out. date in format:
billingperiodenddate=friday, 01-jan-16 00:00:00 utc,
as contains comma may problem...?
thanks
full disclosure: work @ braintree. if have further questions, feel free contact support.
the date attributes return datetime object. try formatting date, may getting object of class datetime not converted string error.
echo("date: " . $result1->subscription->billingperiodenddate->format('y-m-d h:i:s') . "<br />"); let me know if helps!
Comments
Post a Comment