How to access private scoped namespace array data in php? - php

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();

Related

How to get status value string from razorpay array

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;
?>

Getting just one value from an array (php) [duplicate]

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;

Coinbase v2 response are too bad and cant get data from this Object class

I'm using coinbase and I'm trying to get data but the response is it to bad cant even generate to json or array and then to json...
Code:
use Coinbase\Wallet\Client;
use Coinbase\Wallet\Configuration;
use Coinbase\Wallet\Resource\Address;
$configuration = Configuration::apiKey($apiKey, $apiSecret);
$client = Client::create($configuration);
$accounts = $client->getAccounts();
print_r($accounts); //Here is the response from down. But I dont know how to
get data from $accounts->data or anything else cause its not clear repsonse.
The Response is:
Coinbase\Wallet\Resource\ResourceCollection Object ( [previousUri:Coinbase\Wallet\Resource\ResourceCollection:private] => [nextUri:Coinbase\Wallet\Resource\ResourceCollection:private] => [resources:Coinbase\Wallet\Resource\ResourceCollection:private] => Array ( [0] => Coinbase\Wallet\Resource\Account Object ( [name:Coinbase\Wallet\Resource\Account:private] => LTC Wallet [primary:Coinbase\Wallet\Resource\Account:private] => [type:Coinbase\Wallet\Resource\Account:private] => wallet [currency:Coinbase\Wallet\Resource\Account:private] => LTC [balance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0 [currency:Coinbase\Wallet\Value\Money:private] => LTC ) [nativeBalance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0 [currency:Coinbase\Wallet\Value\Money:private] => EUR ) [createdAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2017-11-16 12:00:19.000000 [timezone_type] => 2 [timezone] => Z ) [updatedAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2018-01-17 19:10:56.000000 [timezone_type] => 2 [timezone] => Z ) [id:Coinbase\Wallet\Resource\Resource:private] => someID [resource:Coinbase\Wallet\Resource\Resource:private] => account [resourcePath:Coinbase\Wallet\Resource\Resource:private] => /v2/accounts/someID [rawData:Coinbase\Wallet\Resource\Resource:private] => Array ( [id] => someID [name] => LTC Wallet [primary] => [type] => wallet [currency] => LTC [balance] => Array ( [amount] => 1.00496384 [currency] => LTC ) [created_at] => 2017-11-16T12:00:19Z [updated_at] => 2018-01-17T19:10:56Z [resource] => account [resource_path] => /v2/accounts/someID [native_balance] => Array ( [amount] => 162.25 [currency] => EUR ) ) ) [1] => Coinbase\Wallet\Resource\Account Object ( [name:Coinbase\Wallet\Resource\Account:private] => ETH Wallet [primary:Coinbase\Wallet\Resource\Account:private] => [type:Coinbase\Wallet\Resource\Account:private] => wallet [currency:Coinbase\Wallet\Resource\Account:private] => ETH [balance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0 [currency:Coinbase\Wallet\Value\Money:private] => ETH ) [nativeBalance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0[currency:Coinbase\Wallet\Value\Money:private] => EUR ) [createdAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2017-11-16 12:00:19.000000 [timezone_type] => 2 [timezone] => Z ) [updatedAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2018-01-15 16:50:26.000000 [timezone_type] => 2 [timezone] => Z ) [id:Coinbase\Wallet\Resource\Resource:private] => someID [resource:Coinbase\Wallet\Resource\Resource:private] => account [resourcePath:Coinbase\Wallet\Resource\Resource:private] => /v2/accounts/someID [rawData:Coinbase\Wallet\Resource\Resource:private] => Array ( [id] => someID [name] => ETH Wallet [primary] => [type] => wallet [currency] => ETH [balance] => Array ( [amount] => 1.06493355 [currency] => ETH ) [created_at] => 2017-11-16T12:00:19Z [updated_at] => 2018-01-15T16:50:26Z [resource] => account [resource_path] => /v2/accounts/someID [native_balance] => Array ( [amount] => 942.46 [currency] => EUR ) ) ) [2] => Coinbase\Wallet\Resource\Account Object ( [name:Coinbase\Wallet\Resource\Account:private] => BTC Wallet [primary:Coinbase\Wallet\Resource\Account:private] => 1 [type:Coinbase\Wallet\Resource\Account:private] => wallet [currency:Coinbase\Wallet\Resource\Account:private] => BTC [balance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0 [currency:Coinbase\Wallet\Value\Money:private] => BTC ) [nativeBalance:Coinbase\Wallet\Resource\Account:private] => Coinbase\Wallet\Value\Money Object ( [amount:Coinbase\Wallet\Value\Money:private] => 0 [currency:Coinbase\Wallet\Value\Money:private] => EUR ) [createdAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2017-11-16 12:00:19.000000 [timezone_type] => 2 [timezone] => Z ) [updatedAt:Coinbase\Wallet\Resource\Account:private] => DateTime Object ( [date] => 2018-01-19 21:32:51.000000 [timezone_type] => 2 [timezone] => Z ) [id:Coinbase\Wallet\Resource\Resource:private] => someID [resource:Coinbase\Wallet\Resource\Resource:private] => account [resourcePath:Coinbase\Wallet\Resource\Resource:private] => /v2/accounts/someID [rawData:Coinbase\Wallet\Resource\Resource:private] => Array ( [id] => someID [name] => BTC Wallet [primary] => 1 [type] => wallet [currency] => BTC [balance] => Array ( [amount] => 0.10962561 [currency] => BTC ) [created_at] => 2017-11-16T12:00:19Z [updated_at] => 2018-01-19T21:32:51Z [resource] => account [resource_path] => /v2/accounts/someID [native_balance] => Array ( [amount] => 1067.30 [currency] => EUR ) ) ) ) )
I knows its too big but I cant find a way to get each data.
$data->data
$data["data"]
$data[0]
None works..
You can use
$data = $client->decodeLastResponse();
print_r($data);
that will return an array with all the data you need.

How to retrieve the values from Stripe for webhook

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

access attribute array from transaction object

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
}

Categories