繁体   English   中英

创建客户(PHP)时Braintree DropInUI网关拒绝卡验证不会失败

[英]Braintree DropInUI gateway rejection card verification not failing when creating customer (PHP)

我的(sandbox)结帐代码如下:(为简洁起见,我省略了初始变量声明)

require_once("braintree/braintree_init.php");

$nonceFromTheClient = 'fake-gateway-rejected-fraud-nonce';  

$result = Braintree_Customer::create([
    'id' => $userId,
    'firstName' => $firstName,
    'lastName' => $lastName,
    'email' => $email,
    'paymentMethodNonce' => $nonceFromTheClient,
    'creditCard' => [
        'billingAddress' => [
            'streetAddress' => $billingAddress,
            'locality' => $billingCity,
            'region' => $billingState,
            'postalCode' => $billingZip
        ]
    ]
]);

if ($result->success) {
    echo "create: success";
    $token = $result->customer->paymentMethods[0]->token;
} else {
    echo "create: fail";
    foreach($result->errors->deepAll() AS $error) {
        echo($error->code . ": " . $error->message . "\n");
    }
    $verification = $result->creditCardVerification;
    echo $verification->status;
    echo $verification->processorResponseCode;
    echo $verification->processorResponseText;
    echo $verification->gatewayRejectionReason;
    $verificationError = "There was a problem processing your credit card; please double check your payment information and try again.";
    return false;
}

$result = Braintree_Subscription::create([
    'paymentMethodToken' => $token,
    'planId' => $subId
]);

if ($result->success) {
    $subscriptionId = $result->subscription->id;
    header("Location:  transaction.php?i=".$subscriptionId."");
} else {
    foreach($result->errors->deepAll() AS $error) {
        echo($error->code . ": " . $error->message . "\n");
    }
}

我正在尝试使卡验证失败。 我在“控制面板”中为所有卡启用了验证功能。 当我使用提供的$ nonceFromTheClient ='fake-gateway-rejected-fraud-nonce'时,客户创建仍然成功。

如果我使用“ 信用卡验证不成功”列表中的卡号4000111111111115,则该仍然成功,尽管诚然我不清楚该卡号应使用哪种随机数。

如果我使用“ fake-processor-declined-visa-nonce”,它将失败(按预期)。

因此,我不确定为什么前两次尝试仍能成功进行卡验证?

全面披露:我在Braintree工作。 如果您还有其他疑问,请随时与我们的支持团队联系。

在我们的网关中存储信用卡,默认情况下不会验证信用卡 您必须将verifyCard选项设置为true才能验证卡。

$result = Braintree_Customer::create([
    'firstName' => 'Fred',
    'lastName' => 'Jones',
    'creditCard' => [
        'paymentMethodNonce' => nonceFromTheClient,
        'options' => [
            'verifyCard' => true
        ]
    ]
]);

我们文档的测试部分进一步阐述了伪造的测试随机数的使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM