简体   繁体   中英

Braintree testing, can't get braintree to reject card

It must be something simple but I'm pulling my hair out. When I call this

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

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

I get back "success" from Braintree. How do I get the card declined?

So it turns out that on the Braintree_Transaction::sale method using the fake-nonce isn't the way you do it. You do it with the amount. You match the amount to the error code you want to produce. So an amount of 2001.00 will get a response of "Insufficient Funds" . A list of error codes can be found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM