关于 php:如何在没有在 Braintree 支付网关中进行交易的情况下验证信用卡详细信息?

how to validate credit card details without doing transaction in braintree payment gateway?

我想在一个阶段验证信用卡详细信息并注册我们的网站用户,然后使用同一张信用卡进行交易。
有什么方法可以验证信用卡详细信息而无需在 Braintree 支付网关中进行交易?


全面披露:我为 Braintree 工作。

是的,可以在收费前验证信用卡。首先,确保您的帐户已在控制面板中设置为进行卡验证。对于您描述的流程,您可以创建一个将 verifyCard 标志设置为 true 的客户:
?

1
2
3
4
5
6
7
8
9
10
11
$result = Braintree_Customer::create([
    'firstName' => 'Your',
    'lastName' => 'Customer',
    'email' => '[email protected]',
    'creditCard' => [
        'options' => [
            'verifyCard' => 'true'
        ],
    ],
    'paymentMethodNonce' => 'the-nonce',
]);

?如果客户创建成功,您可以检查结果中的 CreditCardVerification 对象。
?

1
$verification = $result->customer->creditCards[0]->verification

?然后,您可以从创建的客户中提取付款方式令牌并使用它来创建交易。
?

1
$token = $result->customer->creditCards[0]->token

如果您对集成有其他疑问,请联系 Braintree 支持部门。