【发布时间】:2017-07-16 06:50:06
【问题描述】:
我想使用客户 ID 检索 Stripe 令牌。我尝试在 PHP 中使用以下方法:
$num='cus_AkeyZp1eIsJHiI';
$customer=\Stripe\Customer::retrieve($num);
$customer=$customer->sources;
$customer=$customer->数据;
【问题讨论】:
标签: stripe-payments
我想使用客户 ID 检索 Stripe 令牌。我尝试在 PHP 中使用以下方法:
$num='cus_AkeyZp1eIsJHiI';
$customer=\Stripe\Customer::retrieve($num);
$customer=$customer->sources;
$customer=$customer->数据;
【问题讨论】:
标签: stripe-payments
如果您想使用客户的信用卡凭据在 Stripe 上创建另一个客户帐户,请使用:
$token = \Stripe\Token::create(array(
"customer" => $num,
));
echo $token->id;
您在此处创建了代表客户当前卡的令牌。如果需要,您现在可以使用此令牌创建新客户。
$customer = \Stripe\Customer::create(array(
"email" => {CUSTOMER_EMAIL},
"source" => $token->id
));
我认为没有任何方法可以检索您在创建客户时创建的令牌。
或者如果你只需要他附上的卡ID,你可以试试:
$num='cus_AkeyZp1eIsJHiI';
$customer=\Stripe\Customer::retrieve($num);
$customer = $customer->__toArray(true);
print_r($customer['sources']['data']);
这会将卡片附在客户身上。
【讨论】: