【发布时间】:2019-09-21 09:04:10
【问题描述】:
我正在尝试使用带 PHP 的 Stripe API 检索我的 Stripe 余额。
我正在拨打以下电话:
function retrieve_balance()
{
$response = Stripe_Balance::retrieve();
return $response;
}
这会返回如下内容:
object(Stripe_Balance)#28 (5) {
["_apiKey":protected]=>
string(32) "my_key_here"
["_values":protected]=>
array(4) {
["pending"]=>
array(1) {
[0]=>
object(Stripe_Object)#32 (5) {
["_apiKey":protected]=>
string(32) "my_key_here"
["_values":protected]=>
array(2) {
["amount"]=>
int(0)
["currency"]=>
string(3) "usd"
etc...
我已尝试执行以下操作,但仅导致错误。我正在尝试获取待处理和可用的数量。
<?php
var_dump($balance);
/*Issue Line Below*/
echo $balance->pending->amount;
?>
我得到的错误是:Trying to get property of non-object
【问题讨论】:
-
看起来pending是一个对象数组,你试过
$balance->pending[0]->amount
标签: php stripe-payments