Braintree 测试,无法让 braintree 拒绝卡片

Braintree testing, can't get braintree to reject card

这一定很简单,但我正在拔头发。当我调用这个

$data = [
        'amount' => '50.00',
        'paymentMethodNonce' => 'fake-processor-declined-mastercard-nonce',
        'options' => [
            'submitForSettlement' => true
        ]
    ];

    $result = Braintree_Transaction::sale($data);

我从 Braintree "success" 回来了。如何让卡被拒绝?

所以事实证明,在 Braintree_Transaction::sale 方法中使用伪随机数并不是您的做法。你用数量来做。您将金额与要生成的错误代码相匹配。因此 2001.00 的数量将得到 "Insufficient Funds" 的响应。可以找到错误代码列表 here