Braintree沙箱测试(伪随机数)

fre*_*rks 3 php sandbox braintree

我正在测试Braintree沙箱(PHP),即使我使用的是伪随机数据,交易仍然显示有效

我有一个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);
Run Code Online (Sandbox Code Playgroud)

结果

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
Run Code Online (Sandbox Code Playgroud)

我保证这些假的小菜在沙箱中测试错误结果...还是我错过了一些东西

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

小智 6

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

无效的随机数将触发卡验证响应失败,但不会导致交易失败。为了模拟不成功的交易,请改为调整交易金额