【发布时间】:2020-06-22 01:03:08
【问题描述】:
使用 Stripe php,我正在使用下面的代码创建一个新的源代码。
- 然后,当我显示 $response_all 时,它看起来像不错的 json,例如:
{id: "card_xxxxxxxxxx", object: "card", address_city: null, address_country: null, address_line1: null, ...}等......
但是,当我尝试仅使用 $response_id = $response.id;
然后 json 有一个 TEXT 前缀,如 “条纹\卡片 JSON:{ “id”:“card_xxxxxxxxxx”等
问:如何在不获取文本前缀的情况下提取 Card id?
$stripe_customer = $_POST['stripe_customer'];
$stripe = new \Stripe\StripeClient(
'sk_test_xxxxxxxxx'
);
$response = $stripe->customers->createSource(
$stripe_customer,
['source' => $token]
);
$response_all = $response;
$response_id = $response.id;
【问题讨论】:
标签: stripe-payments