Braintree沙盒测试(假nonce)

问题描述 投票:2回答:3

我正在测试Braintree沙箱(PHP),即使我使用假nonce,交易仍然显示有效

我有一个dropin前端和一个PHP后端

我的后端测试代码如下所示:

$amount = '12.00';
$nonce = 'fake-processor-declined-visa-nonce';
$result = Braintree_Transaction::sale(['amount' => $amount, 
                                       'paymentMethodNonce' => $nonce, 
                                       'options' => ['submitForSettlement' => true]
                                      ]);
$debug = get_object_vars($result);
print_r($debug);

结果

Array
(
    [success] => 1
    [transaction] => Braintree\Transaction Object
        (
            [_attributes:protected] => Array
                (
                    [id] => 9bnyb32r
                    [status] => submitted_for_settlement
                    [type] => sale
                    [currencyIsoCode] => EUR
                    [amount] => 12.00
                    [merchantAccountId] => somenamehere
                    [subMerchantAccountId] => 
                    [masterMerchantAccountId] => 
                    [orderId] => 
                    [createdAt] => DateTime Object

我发现假冒的nouces是为了测试沙盒中的错误结果......或者我错过了什么

https://developers.braintreepayments.com/reference/general/testing/php#test-amounts

php sandbox braintree
3个回答
5
投票

完全披露:我在Braintree工作。如果您有任何其他问题,请随时联系support

无效的nonce会触发不成功的card verification response,但不会导致事务失败。为了模拟不成功的交易,请调整amount of the transaction


2
投票

试图在PHP中测试一些类似的东西,我在PHP Braintree库中的\Braintree\Test\Nonces中找到了一些有用的,有名的测试nonce。我能够使用fake-valid-visa-nonce进行创建新付款方式所需的测试。


0
投票

您可以使用字符串'fake-valid-nonce'作为测试销售交易的nonce。您可以在braintree测试文档https://developers.braintreepayments.com/reference/general/testing/php中找到更多虚假的nonce信息

© www.soinside.com 2019 - 2024. All rights reserved.