I created a simple testscript in NodeJS for creating transactions with the Braintree SDK. However, whenever I try to use a fake failing nonce, it just succeeds. I am sure I am missing something simple here, but I can not figure out what it is.
gateway.transaction.sale({
amount: 10,
paymentMethodNonce: "fake-processor-declined-mastercard-nonce",
options: {
submitForSettlement: true
}
}, function(err, res) {
console.log(JSON.stringify(res, null, "\t"));
});
Full disclosure: I work for Braintree.
The fake-processor-declined
nonces don't simulate failed transactions, but failed credit card verifications. Enable card verification in the Braintree control panel by going to Settings > Processing > Card Verification. Then, make your options hash look like this:
options: {
submitForSettlement: true,
verifyCard: true
}
The transaction will no longer succeed and will return an authorization error.
If you are trying to simulate a failed transaction, use a specific test transaction amount with fake-valid-nonce
instead.
If you have any additional questions, feel free to reach out to Braintree support.