Test and Validate
Before you expose Payment Services for Adobe Commerce and Magento Open Source to your shoppers, it is a good idea to test in your sandbox environment and in production. Testing and validation help ensure that Payment Services functions work as expected and provide the best payment options for your store and customers.
Test in sandbox environment
Testing Payment Services in a sandbox environment is an important validation step, even though it is a simulated environment connected only to the PayPal sandbox, not to real banks and merchants.
- Complete a successful checkout from your store, either with Credit Card Fields or any of the PayPal payment buttons. See Testing credentials for more information about using fake credit cards for testing.
- Capture (when your payment action is set to
Authorize and Capture), refund, or void the just-completed order. You can also simply create an invoice for an order, if your payment action is set toAuthorizeinstead ofAuthorize and Capture. - Within 24-48 hours, view the transaction and other information in the Payouts report.
- See details of the order in the Order payment status report.
Test on local development environments
Testing PayPal, PayLater, and Venmo payment methods on local development environments requires your environment to be accessible from the internet. These payment methods use a server-side shipping callback that requires PayPal to communicate with your Commerce instance to retrieve shipping options and calculate totals.
To expose your local environment:
-
Use a tunneling service like ngrok to create a publicly accessible URL for your local environment.
-
Update your Commerce base URL configuration to match the ngrok URL:
code language-bash bin/magento config:set web/unsecure/base_url https://your-ngrok-url.ngrok.io/ bin/magento config:set web/secure/base_url https://your-ngrok-url.ngrok.io/ bin/magento cache:flush -
Complete your testing with the PayPal, PayLater, or Venmo payment methods.
-
Restore your original base URL configuration when testing is complete.
If the endpoint’s response time is under 5 seconds, PayPal displays an error message in the pop-up.
Testing credentials
When testing and validating your sandbox you must use fake credit card numbers, so that you are not creating real charges to an existing credit card account.
Use PayPal’s Credit Card Generator to generate random credit card information for testing.
To test Apple Pay in sandbox mode:
- Create an Apple sandbox tester account, complete with fake credit card and billing information.
- Register your sandbox domains.
Test in production
It is highly recommended that you test Payment Services in production, with real credit cards and banks, before exposing this functionality to shoppers. Even though testing Payment Services in sandbox is important, testing in production is the most fool-proof method for ensuring Payment Services works as expected.
You can test Payment Services in production in one of two ways:
- Choose a time when you know that no orders will be placed by shoppers.
- Use a webstore which is temporarily inaccessible to shoppers, but is accessible to you for testing.
Complete your production testing with real credit cards and PayPal accounts, testing the entire lifecycle of a payment, including capture and refund. Completing the entire checkout and payment flow during testing gives you the clearest picture of how your Payment Services functionality will work when live shoppers are using it.
You should also verify the information that appears on the bank statements for the payment methods you use in production testing are correct and expected (including the description of your business).
To test Apple Pay in production mode, you must register your production domains.