-
StackOverflow 文件
-
stripe-payments 教程
-
條紋將多張卡新增到同一使用者
-
如何稽核客戶並在 Stripe 中新增卡片
public function addCard($cust_id, $token)
{
$retriveResult=Customer::retrieve($cust_id);
$tokendata = Token::retrieve($token);
$newcard = $tokendata['card'];
$flag = 1;
foreach ($retriveResult['sources']['data'] as $card) {
if($card['fingerprint'] === $newcard['fingerprint'])
{
$cardid = $card['id'];
$flag = 0;
break;
}
}
if($flag)
{
$savecard = $retriveResult->sources->create(array("source" =>$token));
$cardid = $savecard['id'];
}
return $cardid;
}