I am testing the Braintree sandbox (PHP) and even though I am using a fake-nonce, the transactions still show goes through valid
I have a dropin frontend and a PHP Backend
My backend code for testing looks like below:
$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);
outcome
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
I assued the fake nouces are there for testing error outcome in the sandbox...or am I missing something
https://developers.braintreepayments.com/reference/general/testing/php#test-amounts
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
Invalid nonces trigger an unsuccessful card verification response, but do not cause transactions to fail. In order to simulate an unsuccessful transaction, adjust the amount of the transaction instead.
Trying to test some similar things in PHP, I found some helpful, well-named test nonces in \Braintree\Test\Nonces
in the PHP Braintree library. I was able to use fake-valid-visa-nonce
to do the testing I needed to create a new payment method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With