亲爱的Brantree开发人员,我正在尝试在我的网站中实施braintree支付,而braintree已经在具有嵌套对象的数组对象中给出了Response我如何访问它?我想从波纹管响应中得到客户的身份。
Braintree_Result_Successful Object
(
[success] => 1
[_returnObjectNames:private] => Array
(
[0] => customer
)
[_attributes] => Array
(
)
[customer] => Braintree_Customer Object
(
[_attributes:protected] => Array
(
[id] => 22635830
[merchantId] => h9xhpt9b5zjgbkpj
[firstName] => Abhishek
[lastName] => Sonawane
[company] => 1
[email] => abhishek@iarianatech.com
[phone] =>
[fax] =>
[website] =>
[createdAt] => DateTime Object
(
)
[updatedAt] => DateTime Object
(
)
[customFields] =>
[creditCards] => Array
(
[0] => Braintree_CreditCard Object
(
[_attributes] => Array
(
[bin] => 510510
[expirationMonth] => 12
[expirationYear] => 2015
[last4] => 5100
[cardType] => MasterCard
[cardholderName] =>
[commercial] => Unknown
[countryOfIssuance] => Unknown
[createdAt] => DateTime Object
(
)
[customerId] => 22635830
[customerLocation] => US
[debit] => Unknown
[default] => 1
[durbinRegulated] => Unknown
[expired] =>
[healthcare] => Unknown
[imageUrl] => https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=sandbox
[issuingBank] => Unknown
[payroll] => Unknown
[prepaid] => Unknown
[subscriptions] => Array
(
)
[token] => 6k2mk2
[uniqueNumberIdentifier] => 0ec6bdfe18781d1bccaea74c4fe55897
[updatedAt] => DateTime Object
(
)
[venmoSdk] =>
[verifications] => Array
(
)
[billingAddress] =>
[expirationDate] => 12/2015
[maskedNumber] => 510510******5100
)
)
)
[addresses] => Array
(
)
[coinbaseAccounts] => Array
(
)
[paypalAccounts] => Array
(
)
[applePayCards] => Array
(
)
)
)
)
答案 0 :(得分:3)
完全披露:我在Braintree工作。如果您有任何其他问题,请随时联系support。
看起来响应来自客户创建呼叫。 To specifically retrieve the id -
$result = Braintree_Customer::create([
'firstName' => 'Mike',
'lastName' => 'Jones',
'company' => 'Jones Co.',
'email' => 'mike.jones@example.com',
'phone' => '281.330.8004',
'fax' => '419.555.1235',
'website' => 'http://example.com'
]);
$result->success;
# true
$id = $result->customer->id;
检查指南的API Response section以获取其他属性。