简体   繁体   English

Laravel:从 ChargeBee 接收数据

[英]Laravel: Receive data from ChargeBee

I managed to create a Customer in ChargeBee but I don't know how to access each of its values.我设法在 ChargeBee 中创建了一个 Customer,但我不知道如何访问它的每个值。

To receive the information I use the following code, it works perfect for me ...要接收我使用以下代码的信息,它非常适合我......

ChargeBee_Environment::configure("mysite-test","test_afhjsfslfsfslk438493sshgeh");
        $result = ChargeBee_Customer::retrieve("16HHGDGJslfksds");
        $customer = $result->customer();
        $card = $result->card();

By doing a dd($result) I get the following:通过执行 dd($result) 我得到以下信息:

ChargeBee_Result {#356 ▼
  -_response: array:1 [▼
    "customer" => array:22 [▼
      "id" => "16HHGDGJslfksds"
      "first_name" => "User"
      "last_name" => "Test"
      "email" => "user@mail.com"
      "phone" => "555667788"
      "auto_collection" => "on"
      "net_term_days" => 0
      "allow_direct_debit" => false
      "created_at" => 1603420880
      "taxability" => "taxable"
      "updated_at" => 1603420880
      "pii_cleared" => "active"
      "resource_version" => 1603420880216
      "deleted" => false
      "object" => "customer"
      "billing_address" => array:6 [▶]
      "card_status" => "no_card"
      "promotional_credits" => 0
      "refundable_credits" => 0
      "excess_payments" => 0
      "unbilled_charges" => 0
      "preferred_currency_code" => "USD"
    ]
  ]
  -_responseObj: array:1 [▼
    "customer" => ChargeBee_Customer {#358 ▶}
  ]
}

How can I get for example the id of this Customer???例如,我怎样才能获得这个客户的 id ??? Which in this case is 16HHGDGJslfksds在这种情况下是 16HHGDGJslfksds

您可以使用这一行:

$customerId = $result->customer()->id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM