我正在处理条带收费功能,我已经从信用卡详细信息创建了客户,并将该客户存储在数据库中,然后我试图通过客户ID向该客户收费,但是当我尝试这样做时我就是得到错误,Cannot charge a customer that has no active card
,这里我添加了我的整个代码,任何人都可以告诉我为什么我收到此错误
\Stripe\Stripe::setApiKey("sk_test_p7WuwfVhQGpu4zb6IZC3MI0b");
\Stripe\Stripe::setApiVersion("2018-05-21");
$amount = 100;
try {
$charge = \Stripe\Charge::create(array(
"amount" => $amount,
"currency" => "usd",
"description" => "",
"customer" => 'cus_DWuoLfjJBSQsWt',
)
);
echo "<pre>";
print_r($charge);
die;
} catch (Exception $ex) {
echo $ex->getMessage(); die;
}
这是因为您正在调用测试帐户的客户ID或反之亦然或您添加的客户卡已过期或现在未进行身份验证。