在PHP中使用Stripe的API。我想從這個測試對象檢索條紋帳戶信息
$customers = \Stripe\Customer::retrieve("cus_8MfE5OY7uZb8qd");
Stripe\Customer JSON: {
"id": "cus_8MfE5OY7uZb8qd",
"object": "customer",
"account_balance": 0,
"created": 1462014302,
"currency": "gbp",
"default_source": "card_185vu8E5mWaZh4R5u4vxBYwJ",
"delinquent": false,
"description": null,
"discount": null,
"email": null,
"livemode": false,
"metadata": {
},
"shipping": null,
"sources": {
"object": "list",
"data": [
{
"id": "card_185vu8E5mWaZh4R5u4vxBYwJ",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "US",
"customer": "cus_8MfE5OY7uZb8qd",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 2,
"exp_year": 2020,
"funding": "credit",
"last4": "4242",
"metadata": {
},
"name": "[email protected]",
"tokenization_method": null
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/customers/cus_8MfE5OY7uZb8qd/sources"
}
}
我可以用
print $customers->description;
當我得到的所有數據到源獲得「LAST4」值到數據,這顯然返回一個數組:
print $customers->sources->data;
我已經嘗試了幾件事來獲得「last4」的價值,但沒有運氣。請有人指點我正確的方向嗎?謝謝!
'$打印客戶 - >來源 - >數據[ 'LAST4'];'這並不工作? – siddiq