使用Stripe.js,我得到了一个card token,然后我可以使用它通过:
Stripe::Charge.create(
:amount => 400,
:currency => "usd",
:card => "tok_103rC02eZvKYlo2C2RD5docg", # obtained with Stripe.js,
:metadata => {'order_id' => '6735'}
)我是否可以多次使用同一个card token向客户收费,或者是1个令牌/费用,如果随后的任何费用,我将必须获取新的令牌?
发布于 2014-04-16 23:45:13
问得好!当您以这种方式使用令牌时,它会立即被使用,因此不能再次使用。但是,您可以将该令牌作为card参数提供,以便在条纹中创建Customer对象时使用。然后,您可以对该客户执行多项指控。
希望这能有所帮助。拉里
附言:我在条纹的支持方面工作。
发布于 2016-11-23 13:31:43
有两件事。一个是令牌,一个是卡id。Token可以使用一次。它也有一定的使用时间限制。将卡片保存到云端后得到的卡片id。我们可以多次使用卡id。Token通过公钥生成。而且这个不能再用了。因此您可以多次使用卡id进行付款。
require_once APPPATH . 'libraries/Stripe.php';
Stripe::setApiKey("***********************"); //Put here your secrect key
//Add card and get token id.
$tokenDetail = Stripe_Token::create(array(
"currency" => "USD",
"card" => array(
"number" => '********', //$credit_card_number,
"exp_month" => '**', //$exp_date_month,
"exp_year" => '**', //$exp_date_year,
"cvc" => '***'//$cvv_number
)
));
$token = $tokenDetail->id;
Stripe::setApiKey("*********************"); ////Put here your secrect key
// Get card id by creating a Customer.
$customer = Stripe_Customer::create(array(
"source" => $tokenDetail->id,
"description" => "For testing purpose",
)
);
$response = Stripe_Charge::create(array(
"amount" => 100,
"currency" => "usd",
"customer" => $customer->id // obtained with Stripe.js
));https://stackoverflow.com/questions/23096516
复制相似问题