【发布时间】:2015-10-16 03:43:29
【问题描述】:
我正在使用 Stripe Payments,并希望让客户能够更改他们的信用卡。参考https://stripe.com/docs/api#create_subscription -> 源码,我尝试了以下PHP代码:
$customer = \Stripe\Customer::retrieve($client_id);
$customer = \Stripe\Customer::create(array(
"source" => $token) //the token contains credit card details
);
这可行,但不幸的是它无意中也创建了一个新的客户 ID:
原始客户 ID 是 cus_6elZAJHMELXkKI,我想保留它。
有谁知道可以在不创建新客户的情况下更新卡的 PHP 代码?
非常感谢您!
PS:以防万一您需要它 - 这是最初的代码 创建了客户和订阅:
$customer = \Stripe\Customer::create(array( "source" => $token, "description" => "{$fn} {$ln}", "email" => $e, "plan" => "basic_plan_id") ); \Stripe\Charge::create(array( "amount" => 10000, # amount in cents, again "currency" => "eur", "customer" => $customer->id) );
【问题讨论】:
标签: php stripe-payments credit-card