2015-12-30 10 views
0

Как мне получить баланс от этого результата?Извлечение атрибута из запроса

Braintree_Customer Object 
(
[_attributes:protected] => Array 
    (
     [id] => 425865 
     [merchantId] => abcddeff 
     [firstName] => Waka 
     [lastName] => Flaka 
     [company] => Waka Flaka Co. 
     [email] => [email protected] 
     [phone] => 281.330.8004 
     [fax] => 419.555.1235 
     [website] => http://example.com 
     [createdAt] => DateTime Object 
      (
       [date] => 2015-11-17 17:57:44.000000 
       [timezone_type] => 3 
       [timezone] => UTC 
      ) 

     [updatedAt] => DateTime Object 
      (
       [date] => 2015-11-17 17:57:44.000000 
       [timezone_type] => 3 
       [timezone] => UTC 
      ) 

     [customFields] => 
     [creditCards] => Array 
      (
       [0] => Braintree_CreditCard Object 
        (
         [_attributes] => Array 
          (
           [bin] => 400551 
           [expirationMonth] => 09 
           [expirationYear] => 2020 
           [last4] => 0004 
           [billingAddress] => Braintree_Address Object 
            (
             [_attributes] => Array 
              (
               [id] => gx 
               [customerId] => 30007705 
               [firstName] => Flaka 
               [lastName] => Waka 
               [company] => 
               [streetAddress] => 
               [extendedAddress] => 
               [locality] => 
               [region] => 
               [postalCode] => 
               [countryCodeAlpha2] => 
               [countryCodeAlpha3] => 
               [countryCodeNumeric] => 
               [countryName] => 
               [createdAt] => DateTime Object 
                (
                 [date] => 2015-11-17 17:57:44.000000 
                 [timezone_type] => 3 
                 [timezone] => UTC 
                ) 

               [updatedAt] => DateTime Object 
                (
                 [date] => 2015-11-17 17:57:44.000000 
                 [timezone_type] => 3 
                 [timezone] => UTC 
                ) 

              ) 

            ) 

           [cardType] => Visa 
           [cardholderName] => Flaka Waka 
           [commercial] => Unknown 
           [countryOfIssuance] => 
           [createdAt] => DateTime Object 
            (
             [date] => 2015-11-17 17:57:44.000000 
             [timezone_type] => 3 
             [timezone] => UTC 
            ) 

           [customerId] => 30007705 
           [customerLocation] => US 
           [debit] => Yes 
           [default] => 1 
           [durbinRegulated] => Yes 
           [expired] => 
           [healthcare] => Unknown 
           [imageUrl] => https://assets.braintreegateway.com/payment_method_logo/visa.png?environment=sandbox 
           [issuingBank] => Unknown 
           [payroll] => Unknown 
           [prepaid] => No 
           [subscriptions] => Array 
            (
             [0] => Braintree_Subscription Object 
              (
               [_attributes] => Array 
                (
                 [addOns] => Array 
                  (
                  ) 

                 [balance] => 0.00 

Мой код получить cardType является

$cardtype = $customer->creditCards[0]->cardType; 

ответ

0

Вы можете попробовать это

$balance = $customer->creditCards[0]->subscriptions[0]->balance; 
+0

Спасибо то, что мне нужно! – NUGGET

+0

Добро пожаловать, брат. –

Смежные вопросы