Paypal Express Checkout Negative test

831 Views Asked by At

I'm implementing the paypal Express Checkout Server-side REST with the php-sdk. When I make a purchase with the buyer's account(with a positive balance) I can finalice the payments.

To validate that the payment is successful I use this code.

$result = $payment->execute($execution, $apiContext);
if ($result->state === "approved") {
    //Finalize the payment...

But I can not do negative tests. When I create a buyer account with a balance of $ 0.0 and I try to make a payment. Always returns the approved "state"

Es esta la forma correcta de validar los pagos? "state === 'approved'" or I need to use other atribute of the response?

¿How I can make negative test in Sandbox enviroment?

Thanks!!

1

There are 1 best solutions below

4
On

You can set up a sandbox account to simulate the customer/issue you want, just click on accounts in the sandbox section on the left hand menu.

So you could set up an account with no money or partial money or whatever you need to test for and use those individual accounts to test.