Php 尝试使用Alamofire访问从条带API返回的数据,但结果不是有效的JSON
我正在尝试使用Alamofire将Swift应用程序与Stripe API接口,但返回的结果有问题。我期望得到有效的JSON,但我得到以下信息:Php 尝试使用Alamofire访问从条带API返回的数据,但结果不是有效的JSON,php,json,swift,stripe-payments,Php,Json,Swift,Stripe Payments,我正在尝试使用Alamofire将Swift应用程序与Stripe API接口,但返回的结果有问题。我期望得到有效的JSON,但我得到以下信息: Stripe\SetupIntent JSON: { "id": "seti_1Go**************g4qyJgp", "object": "setup_intent", "application": null, "cancellation_reason": null, "client_secret"
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,但结果一无所获。阿拉莫菲尔不喜欢现在这样。是否需要以某种方式剥离“Stripe\SetupIntent JSON:”?您可以访问从API返回的JSON对象
body
:
编辑。您还可以使用从对象生成json:
json_encode($setupIntent)
json_encode($setupIntent)