Testing PayPal Express Sandbox Orders in Magento 2

To go about testing PayPal Express sandbox orders in Magento 2 using the API Signature credentials is similar to how you test them in Magento 1. Simply get your details from your PayPal account and copy them into the Magento 2 admin.

Testing PayPal Express sandbox in Magento allows you to check for any existing problems before using live credentials, and potentially avoid losing sales by fixing any unexpected errors. Here are some simple steps to get the credentials implemented.

API Signature details used for sandbox mode can be found within your PayPal Developer account. Log into your Business account at https://developer.paypal.com.

Head to the Dashboard section, then under the Sandbox submenu on the left hand side, click on Accounts.

PayPal by default creates two accounts for you: a buyer and a facilitator.

Testing PayPal Express Sandbox Orders in Magento 2

The facilitator’s email address will be the first detail entered within the Magento 2 admin. Simply head to Stores -> Configuration -> Sales -> Payment Methods, expand the PayPal Express Checkout section and enter the email address in the
Email Associated with PayPal Merchant Account

Testing PayPal Express Sandbox Orders in Magento 2

The API Username, API Password and API Signature credentials can be obtained by clicking on the facilitator email address to expand further details, and then clicking Profile.

Testing PayPal Express Sandbox Orders in Magento 2

An Account Details lightbox should pop up, and you’ll find the API credentials located under the API Credentials tab.

Testing PayPal Express Sandbox Orders in Magento 2

Add the details into the Magento 2 admin, and the Enable this Solution option should now be available to set to Yes.

In addition, ensure that the Sandbox Mode option is set to Yes.

Now that the sandbox PayPal configuration is complete, you can test out the payment method. You can use the Buyer email account that PayPal sets up for you to test payments when needing to log into PayPal to complete a sandbox purchase.

Click on the buyer email address in your PayPal account under Sandbox Accounts and click on the Profile link.

Another lightbox will appear. Under the Profile tab, you’ll be able to view details and change the password of the buyer account.

Testing PayPal Express Sandbox Orders in Magento 2

Under the Funding tab, PayPal will also give you test Bank Account and Credit Card details if you choose to checkout as a guest when testing PayPal Express.

Any orders you make place using PayPal Express sandbox credentials will automatically go into processing state. Be sure to check the whole checkout flow when using PayPal Express to ensure a smooth transition when switching to live payments when real customers start placing orders.

Note: This article is based on Magento Community/Open Source version 2.2.