【发布时间】:2020-09-17 12:21:17
【问题描述】:
我正在尝试使用 Alamofire 将 Swift 应用程序与 Stripe API 连接,但我在返回结果时遇到了问题。我期待有效的 JSON,但我得到以下信息:
Stripe\SetupIntent JSON: {
"id": "seti_1Go**************g4qyJgp",
"object": "setup_intent",
"application": null,
"cancellation_reason": null,
"client_secret": "seti_1Go***************gp_secret_HM*******************ObpHy7Mk",
"created": 1590784053,
"customer": "cus_H*********Tna",
"description": null,
"last_setup_error": null,
"livemode": false,
"mandate": null,
"metadata": [],
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "requires_payment_method",
"usage": "off_session"
}
我正在使用以下 PHP 代码:
$customer = \Stripe\Customer::create();
$setupIntent = \Stripe\SetupIntent::create([
'customer' => $customer->id
]);
$this->response($setupIntent, 200);
如何获取此对象内的 JSON?我尝试将其转换为 json,但我什么也没得到。 Alamofire 不像现在这样喜欢它。我是否需要以某种方式剥离“Stripe\SetupIntent JSON:”?
【问题讨论】:
标签: php json swift stripe-payments