Skip to content

statusHistory not serializing in JSON #354

@zineer

Description

@zineer

When we run

$transaction = \Braintree\Transaction::find($transactionId);
$apiResponse = json_encode($transaction, \JSON_PRETTY_PRINT);

we expect the $apiResponse to include the statusHistory and each of the history item's attributes, but instead we just get an empty object for each history data point:

"statusHistory": [
        {}
    ],

If I instead do a var_dump I see the history does exist and the attributes are there:

    ["statusHistory"]=>
    array(1) {
      [0]=>
      object(Braintree\Transaction\StatusDetails)#728 (1) {
        ["_attributes":protected]=>
        array(5) {
          ["timestamp"]=>
          object(DateTime)#738 (3) {
            ["date"]=>
            string(26) "2025-10-23 18:21:37.000000"
            ["timezone_type"]=>
            int(3)
            ["timezone"]=>
            string(3) "UTC"
          }
          ["status"]=>
          string(10) "authorized"
          ["amount"]=>
          string(5) "15.00"
          ["user"]=>
          string(15) "username_here"
          ["transactionSource"]=>
          string(3) "api"
        }
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions