Testing Paypal transactions in your X-Cart store

Paypal is a common online payment method, used in various eCommerce stores, among which in X-Cart as well. As an administrator of your X-Cart e-store, you will need to test Paypal transactions taking place in your store, before going live. Paypal gives you this capability, by testing your Paypal payment methods in the Paypal Sandbox testing environment. You can test PayPal Payments Standard, PayPal Payments Pro, Website Payments Pro Hosted Solution and Express Checkout methods in the Paypal Sandbox environment, which is a self-contained testing environment for PayPal payment methods. The Sandbox actually simulates Paypal transactions, allowing you to test a checkout procedure concerning Paypal payment methods, without involving any real money transactions. Besides that, everything else is the same as in a real Paypal transaction.

Before starting the tests with Sandbox, you will need to create a couple of test accounts in the Sandbox environment and set your Paypal payment method in X-Cart to test mode, along with some other parameters.

Creating Paypal Test Accounts

First you will need to create a Paypal test buyer and a test seller account, for which you can implement the following steps:

  1. Sign up in https://developer.paypal.com for a Developer Central account and follow the instructions in the site for completing the creation of the account. If you already have an active Paypal account, you can use this account to login in the Paypal Developer site.
  2. Create test accounts for a test buyer and a test seller account. After having signed in the Developer Central website, click on the "Applications" menu and then navigate to "Sandbox accounts". Then you click on the "Create Account" button and you choose the account type, ie, Personal (buyer account), or Business (merchant account). After you have filled in the related fields, click "Create Account".

You can acquire test API credentials for your seller test account, by signing in the Sandbox using this account and following the instructions for obtaining the API credentials.

You can use one of the test accounts to login in the Sandbox test site as the respective test user of that account. For example, you can log in to Developer Central, navigate to the Sandbox test accounts page (Applications > Sandbox Accounts) and click on "Enter Sandbox site" link. You will be presented with a login page where you can login in the PayPal Sandbox test site using the credentials from your buyer test account. This way, you login as the test buyer user in your virtual Paypal account and check any virtual transactions that have taken place (eg virtual payments you have received from your X-Cart store as the test seller/merchant).

Setting your Paypal payment method to Test mode

In the X-Cart admin, navigate to your Paypal payment method configuration page and set it to Test mode. You can also fill-in any required API credentials that you have acquired from your test Paypal account, if needed, according to the type of the Paypal payment method you want to test. Here, it is important to set the 'Account' field to the Paypal account email of the test seller (test merchant) that you have created in the Sandbox. This is the virtual seller to which the test payments from a test customer will be sent to, after a test order has been submitted in your X-Cart store.

Testing checkout through Paypal

Shortly, before submitting a test order as a test customer, you will need to have logged in the Developer Central, so the proccess of directing the test customer to the Sandbox test environment is smooth and straight. For example, just before going to checkout, open a new window and through it, log in the Developer Central. Then, switch to the previous window that displays your store and proceed to checkout as the test customer, for which you have created the Paypal test buyer account previously.

After submitting the order, you will be driven to the Paypal login page for conducting the payment. You log in your virtual Paypal test site using the credentials of the test buyer account. The test seller's (test merchant) data are displayed on the next Paypal page, where you complete the payment as in a real transaction.

After payment, you can login in the Developer Central first and then in the Sandbox environment, either as the test merchant (using the test seller's account credentials), or as the test buyer (using the test buyer's account credentials) in order to check and confirm the transactions on each side. On the test seller's side, you can view transactions related to payments received from orders in your store, whereas in the test seller's side you can view transactions related to payments sent.

So, by implementing the above steps, you can simulate various Paypal transactions and confirm that your account is set up correctly, before switching your Paypal payment method mode to 'Live' on the Paypal configuration page.