php - Braintree 沙盒测试(假随机数)

标签 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);

结果

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

最佳答案

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

无效随机数触发不成功 card verification response ,但不会导致交易失败。为了模拟不成功的交易,调整 amount of the transaction相反。

关于php - Braintree 沙盒测试(假随机数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38283977/

相关文章:

serial-port - 使用在 Flatpak 中运行的应用程序访问串行端口

javascript - V8 公开类但在特定代码中对其进行限制

Paypal 与布伦特里说 "Merchant account not found"

php - Braintree 付款托管资金

php - Braintree 付款 - 处理器拒绝(2409)沙盒交易错误

php - SQL 查询无效/不显示结果

javascript - 如何使用 AJAX/PHP 编辑 mySQL 表中的一行?

php - PayPal 的 PayPal 沙盒在确认时挂起

javascript - 单击元素的复选框时更新数据库字段

PHP 无法在虚拟主机中运行