This question already has answers here:
How to loop through PHP object with dynamic keys [duplicate]
(16 answers)
Closed 3 years ago.
When I print print_r($event_json); it gives me the array below. I need to get just one value from it [type] as in [type] => charge.succeeded (see the top of the array). I tried echo $event_json[0]['type']; but I am getting nothing.
stdClass Object
(
[created] => 1326853478
[livemode] =>
[id] => charge.succeeded_00000000000000
[type] => charge.succeeded
[object] => event
[request] =>
[pending_webhooks] => 1
[api_version] => 2018-10-31
[data] => stdClass Object
(
[object] => stdClass Object
(
[id] => ch_00000000000000
[object] => charge
[amount] => 500
[amount_refunded] => 0
[application] =>
[application_fee] =>
[application_fee_amount] =>
[balance_transaction] => txn_00000000000000
[billing_details] => stdClass Object
(
[address] => stdClass Object
(
[city] =>
[country] =>
[line1] =>
[line2] =>
[postal_code] =>
[state] =>
)
[email] =>
[name] => someemail#yahoo.com
[phone] =>
)
[captured] =>
[created] => 1553691107
[currency] => usd
[customer] => cus_00000000000000
[description] =>
[destination] =>
[dispute] =>
[failure_code] => card_declined
[failure_message] => Your card was declined.
[fraud_details] => stdClass Object
(
[stripe_report] => fraudulent
)
[invoice] =>
[livemode] =>
[metadata] => stdClass Object
(
)
[on_behalf_of] =>
[order] =>
[outcome] => stdClass Object
(
[network_status] => not_sent_to_network
[reason] => merchant_blacklist
[risk_level] => highest
[risk_score] => 98
[seller_message] => Stripe blocked this payment.
[type] => blocked
)
[paid] => 1
[payment_intent] =>
[payment_method_details] => stdClass Object
(
[card] => stdClass Object
(
[brand] => visa
[checks] => stdClass Object
(
[address_line1_check] =>
[address_postal_code_check] =>
[cvc_check] => unavailable
)
[country] => US
[exp_month] => 1
[exp_year] => 2022
[fingerprint] => Gawa768Trrk4fEmb
[funding] => credit
[last4] => 0019
[three_d_secure] =>
[wallet] =>
)
[type] => card
)
[receipt_email] =>
[receipt_number] =>
[receipt_url] => https://pay.stripe.com/receipts/acct_1DU4J1IcP22cq9aQ/ch_1EIbENIcP22cq9aQk7r9xN3u/rcpt_Em9Xy3Ambv1b8QZISOsIHdbxCnLdgup
[refunded] =>
[refunds] => stdClass Object
(
[object] => list
[data] => Array
(
)
[has_more] =>
[total_count] => 0
[url] => /v1/charges/ch_1EIbENIcP22cq9aQk7r9xN3u/refunds
)
[review] =>
[shipping] =>
[source] => stdClass Object
(
[id] => card_00000000000000
[object] => card
[address_city] =>
[address_country] =>
[address_line1] =>
[address_line1_check] =>
[address_line2] =>
[address_state] =>
[address_zip] =>
[address_zip_check] =>
[brand] => Visa
[country] => US
[customer] => cus_00000000000000
[cvc_check] => unavailable
[dynamic_last4] =>
[exp_month] => 1
[exp_year] => 2022
[fingerprint] => Gawa768Trrk4fEmb
[funding] => credit
[last4] => 0019
[metadata] => stdClass Object
(
)
[name] => someemail#yahoo.com
[tokenization_method] =>
)
[source_transfer] =>
[statement_descriptor] =>
[status] => failed
[transfer_data] =>
[transfer_group] =>
)
)
)
What you are seeing is an stdClass Object and not an array. Do like below:
<?php
echo $event_json->type;
Related
Razorpay\Api\Payment Object ( [attributes:protected] => Array ( [id] => pay_IOx1H64JMSEFAv [entity] => payment [amount] => 100 [currency] => INR [status] => captured [order_id] => order_IOx0xic60K6TZi [invoice_id] => [international] => [method] => wallet [amount_refunded] => 0 [refund_status] => [captured] => 1 [description] => [card_id] => [bank] => [wallet] => payzapp [vpa] => [email] => sudiptobain8#gmail.com [contact] => +919134322935 [notes] => Razorpay\Api\Payment Object ( [attributes:protected] => Array ( [shopping_order_id] => 3456 ) ) [fee] => 2 [tax] => 0 [error_code] => [error_description] => [error_source] => [error_step] => [error_reason] => [acquirer_data] => Razorpay\Api\Payment Object ( [attributes:protected] => Array ( [transaction_id] => ) ) [created_at] => 1637649968 ) )
help to get [status] => captured From This in php
You need to capture objects using object (arrow) notation
<?php
echo $result->status;
?>
I have the following array and when I do print("<pre>".print_r($term_arr,true)."</pre>");, I get:
Array
(
[0] => Array
(
[status] => 1
[message] => Charge attempted
[data] => Array
(
[amount] => 1000000
[currency] => NGN
[transaction_date] => 2021-05-04T03:18:03.000Z
[status] => success
[reference] => tbhlnqs9elbcoth
[domain] => test
[metadata] =>
[gateway_response] => Approved
[message] =>
[channel] => card
[ip_address] =>
[log] =>
[fees] => 25000
[authorization] => Array
(
[authorization_code] => AUTH_z260f8cskt
[bin] => 408408
[last4] => 4081
[exp_month] => 12
[exp_year] => 2030
[channel] => card
[card_type] => visa
[bank] => TEST BANK
[country_code] => NG
[brand] => visa
[reusable] => 1
[signature] => SIG_TyzxLul2N9M3RSX5MJIY
[account_name] =>
)
[customer] => Array
(
[id] => 43591782
[first_name] =>
[last_name] =>
[email] => ele48#gmail.com
[customer_code] => CUS_rs2vvoeo7pe6f1b
[phone] =>
[metadata] =>
[risk_action] => default
[international_format_phone] =>
)
[plan] =>
[id] => 1112036335
)
)
[1] => Array
(
[status] => 1
[message] => Charge attempted
[data] => Array
(
[amount] => 100000
[currency] => NGN
[transaction_date] => 2021-05-04T03:18:03.000Z
[status] => success
[reference] => fxi85hsbg2u8jwi
[domain] => test
[metadata] =>
[gateway_response] => Approved
[message] =>
[channel] => card
[ip_address] =>
[log] =>
[fees] => 1500
[authorization] => Array
(
[authorization_code] => AUTH_bn008ru8rq
[bin] => 408408
[last4] => 4081
[exp_month] => 12
[exp_year] => 2030
[channel] => card
[card_type] => visa
[bank] => TEST BANK
[country_code] => NG
[brand] => visa
[reusable] => 1
[signature] => SIG_TyzxLul2N9M3RSX5MJIY
[account_name] =>
)
[customer] => Array
(
[id] => 43746063
[first_name] =>
[last_name] =>
[email] => gabwebby#gmail.com
[customer_code] => CUS_d4r1mko8twyc6vg
[phone] =>
[metadata] =>
[risk_action] => default
[international_format_phone] =>
)
[plan] =>
[id] => 1112036343
)
)
I am trying to get the value of customer, so I did the following:
foreach($term_arr as $value){
echo 'Title: ' . $value->customer->customer_code .'<br/>';
}
But I have this error:
PHP Notice: Trying to get property 'customer' of non-object in PHP
Notice: Trying to get property 'customer_code' of non-object in
How can I get the values of array object?
Firstly your inner array is associatve array so if we want values to get we need to traverse using key.
Solution you tried to get customer code where hierarchy is not proper
When you iterate over you parent index array hierarchy is data->customer->customer code
so your customer resides under data array thats why you are getting notice that customer is non object of value.
So solution or you can iterate like will give you customer code,
foreach($term_arr as $value){
print_r($value["data"]["customer"]["customer_code"]."\n");
}
I am using webhook of stripe to receive some information after successful payment
but it give me error
<?php
include 'dbConfig.php'; // For Connecting the database to Store the retrieve value in SQL database
include 'init.php';
Stripe::setApiKey("sk_test_*****************");
// retrieve the request's body and parse it as JSON
$input = file_get_contents("php://input");
$event = json_decode($input);
if ($event_json->type == "charge.succeeded") {
print_r($event_json);
}
its give me this response
stdClass Object
(
[created] => 1326853478
[livemode] =>
[id] => evt_00000000000000
[type] => charge.succeeded
[object] => event
[request] =>
[pending_webhooks] => 1
[api_version] => 2017-02-14
[data] => stdClass Object
(
[object] => stdClass Object
(
[id] => ch_00000000000000
[object] => charge
[amount] => 249
[amount_refunded] => 0
[application] =>
[application_fee] =>
[balance_transaction] => txn_00000000000000
[captured] => 1
[created] => 1489056204
[currency] => usd
[customer] =>
[description] => Movie Title
[destination] =>
[dispute] =>
[failure_code] =>
[failure_message] =>
[fraud_details] => stdClass Object
(
)
[invoice] =>
[livemode] =>
[metadata] => stdClass Object
(
[order_id] => 6735
)
[on_behalf_of] =>
[order] =>
[outcome] => stdClass Object
(
[network_status] => approved_by_network
[reason] =>
[risk_level] => normal
[seller_message] => Payment complete.
[type] => authorized
)
[paid] => 1
[receipt_email] =>
[receipt_number] =>
[refunded] =>
[refunds] => stdClass Object
(
[object] => list
[data] => Array
(
)
[has_more] =>
[total_count] => 0
[url] => /v1/charges/ch_19vOjwKGQPjNjAif9fuYkcsj/refunds
)
[review] =>
[shipping] =>
[source] => stdClass Object
(
[id] => card_00000000000000
[object] => card
[address_city] => ludhiana
[address_country] => AL
[address_line1] => hn 88 st.no5
[address_line1_check] => pass
[address_line2] =>
[address_state] => skdjflsdf
[address_zip] => skfnsd
[address_zip_check] => pass
[brand] => Visa
[country] => US
[customer] =>
[cvc_check] => pass
[dynamic_last4] =>
[exp_month] => 1
[exp_year] => 2018
[funding] => credit
[last4] => 4242
[metadata] => stdClass Object
(
)
[name] => jagtarnice
[tokenization_method] =>
)
[source_transfer] =>
[statement_descriptor] =>
[status] => succeeded
[transfer_group] =>
)
)
)
and i want to store value from this response
like status, paymentdate and description
$customer_id = $event_json->data->object->customer;
$customer = Stripe_Customer::retrieve($customer_id);
$charge_id = $event_json->data->object->id;
$charge = Stripe_Charge::retrieve($charge_id);
This thing is not works
Here is the array data:
Coinbase\Wallet\Resource\ResourceCollection Object
(
[previousUri:Coinbase\Wallet\Resource\ResourceCollection:private] =>
[nextUri:Coinbase\Wallet\Resource\ResourceCollection:private] => /v2/accounts/REMOVED/transactions?starting_after=REMOVED
[resources:Coinbase\Wallet\Resource\ResourceCollection:private] => Array
(
[0] => Coinbase\Wallet\Resource\Transaction Object
(
[type:Coinbase\Wallet\Resource\Transaction:private] => send
[status:Coinbase\Wallet\Resource\Transaction:private] => completed
[amount:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Money Object
(
[amount:Coinbase\Wallet\Value\Money:private] => -0.00016600
[currency:Coinbase\Wallet\Value\Money:private] => BTC
)
[nativeAmount:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Money Object
(
[amount:Coinbase\Wallet\Value\Money:private] => -0.07
[currency:Coinbase\Wallet\Value\Money:private] => USD
)
[description:Coinbase\Wallet\Resource\Transaction:private] => Your first bitcoin!
[fee:Coinbase\Wallet\Resource\Transaction:private] =>
[instantExchange:Coinbase\Wallet\Resource\Transaction:private] =>
[createdAt:Coinbase\Wallet\Resource\Transaction:private] => DateTime Object
(
[date] => 2016-05-18 21:04:04.000000
[timezone_type] => 2
[timezone] => Z
)
[updatedAt:Coinbase\Wallet\Resource\Transaction:private] => DateTime Object
(
[date] => 2016-05-18 21:16:50.000000
[timezone_type] => 2
[timezone] => Z
)
[network:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Network Object
(
[status:Coinbase\Wallet\Value\Network:private] => confirmed
[hash:Coinbase\Wallet\Value\Network:private] => REMOVED
)
[to:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Resource\BitcoinAddress Object
(
[address:Coinbase\Wallet\Resource\BitcoinAddress:private] => 1BJcYDCMHJ3FAqj8YKbcnNq5xxHcxViD5s
[id:Coinbase\Wallet\Resource\Resource:private] =>
[resource:Coinbase\Wallet\Resource\Resource:private] => bitcoin_address
[resourcePath:Coinbase\Wallet\Resource\Resource:private] =>
[rawData:Coinbase\Wallet\Resource\Resource:private] =>
)
[from:Coinbase\Wallet\Resource\Transaction:private] =>
[address:Coinbase\Wallet\Resource\Transaction:private] =>
[application:Coinbase\Wallet\Resource\Transaction:private] =>
[buy:Coinbase\Wallet\Resource\Transaction:private] =>
[sell:Coinbase\Wallet\Resource\Transaction:private] =>
[id:Coinbase\Wallet\Resource\Resource:private] => REMOVED
[resource:Coinbase\Wallet\Resource\Resource:private] => transaction
[resourcePath:Coinbase\Wallet\Resource\Resource:private] => /v2/accounts/REMOVED/transactions/REMOVED
[rawData:Coinbase\Wallet\Resource\Resource:private] => Array
(
[id] => REMOVED
[type] => send
[status] => completed
[amount] => Array
(
[amount] => -0.00016600
[currency] => BTC
)
[native_amount] => Array
(
[amount] => -0.07
[currency] => USD
)
[description] => Your first bitcoin!
[created_at] => 2016-05-18T21:04:04Z
[updated_at] => 2016-05-18T21:16:50Z
[resource] => transaction
[resource_path] => /v2/accounts/REMOVED/transactions/REMOVED
[instant_exchange] =>
[network] => Array
(
[status] => confirmed
[hash] => REMOVED
)
[to] => Array
(
[resource] => bitcoin_address
[address] => 1BJcYDCMHJ3FAqj8YKbcnNq5xxHcxViD5s
)
[details] => Array
(
[title] => Sent bitcoin
[subtitle] => to Bitcoin address
)
)
)
[1] => Coinbase\Wallet\Resource\Transaction Object
(
[type:Coinbase\Wallet\Resource\Transaction:private] => send
[status:Coinbase\Wallet\Resource\Transaction:private] => completed
[amount:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Money Object
(
[amount:Coinbase\Wallet\Value\Money:private] => -0.00016600
[currency:Coinbase\Wallet\Value\Money:private] => BTC
)
[nativeAmount:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Money Object
(
[amount:Coinbase\Wallet\Value\Money:private] => -0.07
[currency:Coinbase\Wallet\Value\Money:private] => USD
)
[description:Coinbase\Wallet\Resource\Transaction:private] => Your first bitcoin!
[fee:Coinbase\Wallet\Resource\Transaction:private] =>
[instantExchange:Coinbase\Wallet\Resource\Transaction:private] =>
[createdAt:Coinbase\Wallet\Resource\Transaction:private] => DateTime Object
(
[date] => 2016-05-18 20:41:29.000000
[timezone_type] => 2
[timezone] => Z
)
[updatedAt:Coinbase\Wallet\Resource\Transaction:private] => DateTime Object
(
[date] => 2016-05-18 20:45:51.000000
[timezone_type] => 2
[timezone] => Z
)
[network:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Value\Network Object
(
[status:Coinbase\Wallet\Value\Network:private] => confirmed
[hash:Coinbase\Wallet\Value\Network:private] => REMOVED
)
[to:Coinbase\Wallet\Resource\Transaction:private] => Coinbase\Wallet\Resource\BitcoinAddress Object
(
[address:Coinbase\Wallet\Resource\BitcoinAddress:private] => 1BJcYDCMHJ3FAqj8YKbcnNq5xxHcxViD5s
[id:Coinbase\Wallet\Resource\Resource:private] =>
[resource:Coinbase\Wallet\Resource\Resource:private] => bitcoin_address
[resourcePath:Coinbase\Wallet\Resource\Resource:private] =>
[rawData:Coinbase\Wallet\Resource\Resource:private] =>
)
[from:Coinbase\Wallet\Resource\Transaction:private] =>
[address:Coinbase\Wallet\Resource\Transaction:private] =>
[application:Coinbase\Wallet\Resource\Transaction:private] =>
[buy:Coinbase\Wallet\Resource\Transaction:private] =>
[sell:Coinbase\Wallet\Resource\Transaction:private] =>
[id:Coinbase\Wallet\Resource\Resource:private] => REMOVED
[resource:Coinbase\Wallet\Resource\Resource:private] => transaction
[resourcePath:Coinbase\Wallet\Resource\Resource:private] => /v2/accounts/REMOVED/transactions/REMOVED
[rawData:Coinbase\Wallet\Resource\Resource:private] => Array
(
[id] => REMOVED
[type] => send
[status] => completed
[amount] => Array
(
[amount] => -0.00016600
[currency] => BTC
)
[native_amount] => Array
(
[amount] => -0.07
[currency] => USD
)
[description] => Your first bitcoin!
[created_at] => 2016-05-18T20:41:29Z
[updated_at] => 2016-05-18T20:45:51Z
[resource] => transaction
[resource_path] => /v2/accounts/REMOVED/transactions/REMOVED
[instant_exchange] =>
[network] => Array
(
[status] => confirmed
[hash] => REMOVED
)
[to] => Array
(
[resource] => bitcoin_address
[address] => 1BJcYDCMHJ3FAqj8YKbcnNq5xxHcxViD5s
)
[details] => Array
(
[title] => Sent bitcoin
[subtitle] => to Bitcoin address
)
)
)
I am trying to figure out how to access a few of these variables.
For instance, how can I make this happen:
$bitcoin_address = [address:Coinbase\Wallet\Resource\Address:private];
$type = [type:Coinbase\Wallet\Resource\Transaction:private];
I know you can't access private scopes, but is there any way around this? Can I scrape the data if there isn't a better way?
Thanks.
Yeah, the best way to access to your data is using decodeLastResponse Function.
Its allow to pull out all the data you need in those arrays.
$address = $client->getAccountAddress($account, $addressId);
$transactions = $client->getAddressTransactions($address);
$transactions = $client->decodeLastResponse();
echo var_dump($transactions['data']);
Almost all this private properties has public getters (public methods that allow you to access the private properties).
$bitcoinAddresses = [];
$types = [];
foreach ($resourceCollection->all() as $transaction) {
$bitcoinAddresses[] = $transaction->getTo()->getAddress();
$types[] = $transaction->getType();
}
If you visit coinbase/coinbase-php repo, you can see the source code there. There are all the classes you described with all the attributes and methods.
You need to call function decodeLastResponse like this:
$addresses = $client->getAccountAddresses($account)
$addresses = $client->decodeLastResponse();
from the response of braintree. access attribute array from transaction object
which way to access it?
Braintree\Transaction Object (
[_attributes:protected] => Array (
[id] => 3ytqkd
[status] => authorized
[type] => sale
[currencyIsoCode] => USD
[amount] => 100.00
[merchantAccountId] => arvaan
[orderId] =>
[createdAt] => DateTime Object
(
[date] => 2015-12-01 07:15:40
[timezone_type] => 3
[timezone] => UTC
)
[updatedAt] => DateTime Object
(
[date] => 2015-12-01 07:15:40
[timezone_type] => 3
[timezone] => UTC
)
[customer] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[email] =>
[website] =>
[phone] =>
[fax] =>
)
[billing] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[streetAddress] =>
[extendedAddress] =>
[locality] =>
[region] =>
[postalCode] =>
[countryName] =>
[countryCodeAlpha2] =>
[countryCodeAlpha3] =>
[countryCodeNumeric] =>
)
[refundId] =>
[refundIds] => Array
(
)
[refundedTransactionId] =>
[partialSettlementTransactionIds] => Array
(
)
[authorizedTransactionId] =>
[settlementBatchId] =>
[shipping] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[streetAddress] =>
[extendedAddress] =>
[locality] =>
[region] =>
[postalCode] =>
[countryName] =>
[countryCodeAlpha2] =>
[countryCodeAlpha3] =>
[countryCodeNumeric] =>
)
[customFields] =>
[avsErrorResponseCode] =>
[avsPostalCodeResponseCode] => I
[avsStreetAddressResponseCode] => I
[cvvResponseCode] => M
[gatewayRejectionReason] =>
[processorAuthorizationCode] => DHYKZ3
[processorResponseCode] => 1000
[processorResponseText] => Approved
[additionalProcessorResponse] =>
[voiceReferralNumber] =>
[purchaseOrderNumber] =>
[taxAmount] =>
[taxExempt] =>
[creditCard] => Array
(
[token] =>
[bin] => 555555
[last4] => 4444
[cardType] => MasterCard
[expirationMonth] => 12
[expirationYear] => 2017
[customerLocation] => US
[cardholderName] =>
[imageUrl] => https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox
[prepaid] => Unknown
[healthcare] => Unknown
[debit] => Unknown
[durbinRegulated] => Unknown
[commercial] => Unknown
[payroll] => Unknown
[issuingBank] => Unknown
[countryOfIssuance] => Unknown
[productId] => Unknown
[uniqueNumberIdentifier] =>
[venmoSdk] =>
)
[statusHistory] => Array
(
[0] => Braintree\Transaction\StatusDetails Object
(
[_attributes:protected] => Array
(
[timestamp] => DateTime Object
(
[date] => 2015-12-01 07:15:40
[timezone_type] => 3
[timezone] => UTC
)
[status] => authorized
[amount] => 100.00
[user] => jitendra.arvaan
[transactionSource] => api
)
)
)
[planId] =>
[subscriptionId] =>
[subscription] => Array
(
[billingPeriodEndDate] =>
[billingPeriodStartDate] =>
)
[addOns] => Array
(
)
[discounts] => Array
(
)
[descriptor] => Braintree\Descriptor Object
(
[_attributes:protected] => Array
(
[name] =>
[phone] =>
[url] =>
)
)
[recurring] =>
[channel] =>
[serviceFeeAmount] =>
[escrowStatus] =>
[disbursementDetails] => Braintree\DisbursementDetails Object
(
[_attributes:protected] => Array
(
[disbursementDate] =>
[settlementAmount] =>
[settlementCurrencyIsoCode] =>
[settlementCurrencyExchangeRate] =>
[fundsHeld] =>
[success] =>
)
)
[disputes] => Array
(
)
[paymentInstrumentType] => credit_card
[processorSettlementResponseCode] =>
[processorSettlementResponseText] =>
[threeDSecureInfo] =>
[creditCardDetails] => Braintree\Transaction\CreditCardDetails Object
(
[_attributes:protected] => Array
(
[token] =>
[bin] => 555555
[last4] => 4444
[cardType] => MasterCard
[expirationMonth] => 12
[expirationYear] => 2017
[customerLocation] => US
[cardholderName] =>
[imageUrl] => https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox
[prepaid] => Unknown
[healthcare] => Unknown
[debit] => Unknown
[durbinRegulated] => Unknown
[commercial] => Unknown
[payroll] => Unknown
[issuingBank] => Unknown
[countryOfIssuance] => Unknown
[productId] => Unknown
[uniqueNumberIdentifier] =>
[venmoSdk] =>
[expirationDate] => 12/2017
[maskedNumber] => 555555******4444
)
)
[customerDetails] => Braintree\Transaction\CustomerDetails Object
(
[_attributes:protected] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[email] =>
[website] =>
[phone] =>
[fax] =>
)
)
[billingDetails] => Braintree\Transaction\AddressDetails Object
(
[_attributes:protected] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[streetAddress] =>
[extendedAddress] =>
[locality] =>
[region] =>
[postalCode] =>
[countryName] =>
[countryCodeAlpha2] =>
[countryCodeAlpha3] =>
[countryCodeNumeric] =>
)
)
[shippingDetails] => Braintree\Transaction\AddressDetails Object
(
[_attributes:protected] => Array
(
[id] =>
[firstName] =>
[lastName] =>
[company] =>
[streetAddress] =>
[extendedAddress] =>
[locality] =>
[region] =>
[postalCode] =>
[countryName] =>
[countryCodeAlpha2] =>
[countryCodeAlpha3] =>
[countryCodeNumeric] =>
)
)
[subscriptionDetails] => Braintree\Transaction\SubscriptionDetails Object
(
[_attributes:protected] => Array
(
[billingPeriodEndDate] =>
[billingPeriodStartDate] =>
)
)
)
)
can access object using magic method
$transaction_id = $result->transaction->__get('id');
you havr to loop through the response you have got using foreach(),
foreach($reas->_attributes as $key => $val) {
echo $key;// will give you the attribute name
is_array($val) ? print_r($val) : echo $val;// will give you the attribute value
}