我正在测试 Braintree 沙盒(PHP),即使我使用的是 fake-nonce,交易仍然显示为 有效。
我有一个下拉式前端和一个 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
我认为这些伪随机数是用于沙箱测试错误结果的,或者我有所遗漏。
参考链接: https://developers.braintreepayments.com/reference/general/testing/php#test-amounts