我想在一个阶段验证信用卡详细信息并注册我们的网站用户,然后使用相同的信用卡进行交易。有没有办法在不在大脑树支付网关中进行交易的情况下验证信用卡详细信息?
完全披露:我在Braintree工作。
是的,可以在收费前验证信用卡。首先,确保您的帐户已在控制面板中设置为卡验证。对于所描述的流,您可以创建一个将 verifyCard
标志设置为 true
的客户:
$result = Braintree_Customer::create([
'firstName' => 'Your',
'lastName' => 'Customer',
'email' => 'customer@example.com',
'creditCard' => [
'options' => [
'verifyCard' => 'true'
],
],
'paymentMethodNonce' => 'the-nonce',
]);
如果成功创建客户,则可以检查信用卡验证对象的结果。
$verification = $result->customer->creditCards[0]->verification
然后,您可以从创建的客户中提取付款方式令牌,并使用它来创建交易。
$token = $result->customer->creditCards[0]->token
如果您对集成有其他疑问,请联系 Braintree 支持。