cancel
Showing results for 
Search instead for 
Did you mean: 

Negative testing not working

Options
hiboudev
Contributor
Posted on

Hello,

 

I'm trying to enable Negative Testing but I can't simulate any error, order capture is still in status COMPLETED.

 

I'm using the sandbox buyer and business accounts and this last one has Negative Testing enable in dashboard.

 

My PHP code to capture order :

 

 

class PaypalOrder
{
    public static function captureOrder($orderId, $debug = false)
    {
        $request = new OrdersCaptureRequest($orderId);
        $request->headers["PayPal-Mock-Response"] = json_decode("{'mock_application_codes' : 'AUTHORIZATION_DENIED'}");

        $client = PayPalClient::client();
        $response = $client->execute($request);

        return $response;
    }
}

 

 

The "mock_application_codes" part seems useless, PayPal returns payment status "COMPLETED".

 

What could be wrong?

 

Thanks.

 

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.