Php 条带:向已创建的客户添加新卡
我已经添加了一个stripe客户,我正在考虑向客户添加新卡。我四处搜索,但没有找到任何符合我以下问题的答案Php 条带:向已创建的客户添加新卡,php,laravel,stripe-payments,stripe.js,Php,Laravel,Stripe Payments,Stripe.js,我已经添加了一个stripe客户,我正在考虑向客户添加新卡。我四处搜索,但没有找到任何符合我以下问题的答案 有没有自己的任何形式的新卡添加 以下是添加新卡的正确方法吗 $customer = \Stripe\Customer::retrieve(Auth::user()->stripe_key); // Got the customer details successfully from the above call. $card = $customer->cards->c
$customer = \Stripe\Customer::retrieve(Auth::user()->stripe_key);
// Got the customer details successfully from the above call.
$card = $customer->cards->create(
array(
"card" =>
array(
"number"=> "4242424242424242",
"exp_month" => "12",
"exp_year" => "2016",
"cvc" => "123"
)
)
);
Stripe没有专门用于向客户添加新卡的直接表单,但是您可以使用Checkout或元素来收集客户的卡详细信息 向客户添加新卡的过程如下:
[1] -您需要先创建客户,然后检索该客户。然后
$customer->sources->create(数组(“source”=>“tok_万事达卡”)代码>看一看@SafoorSafdar请定义(数组(“source”=>“tok_mastercard”)
你评论的一部分,那就是我被卡住的部分。
$token = $_POST['stripeToken']; #for example
$customer = \Stripe\Customer::retrieve(Auth::user()->stripe_key);
$customer->sources->create(array("source" => $token));