How to Automate Checkouts and Payments on Shopify?

By Michael Da Silva | August 24, 2022

Anyone who has ever set up a Shopify store knows that one of the most time-consuming and frustrating tasks is setting up test orders and payments. It's a process that can take hours, and it's easy to make mistakes.

But, testing your Shopify store is crucial! It helps prevent any bugs or malfunctions from occurring on-site so that consumers have a great experience with every purchase!

When designing an e-commerce website using Shopify's platform, you must test the order process to verify that checkout and payment operations function effectively. In general, there are two ways to approach this issue - manually or automatically.

If this is your first time testing an order, begin with a manual test, and then we'll walk you through automation testing as well. Manually testing all of this becomes difficult over time, which is why you should begin considering which tests you can automate to increase quality assurance productivity.

When testing several datasets, automation is much more convenient than manual testing. As an example, suppose you want to ensure that your shipping costs and payment methods are configured appropriately for each country. Moreover, it will be less time-consuming to reuse the same test script with different datasets several times rather than doing the tests manually.

You will learn the following in this blog post:

Why do you need to test orders on Shopify?

There are a few key reasons why you might want to test orders on Shopify.

First, you'll want to test orders on Shopify to make sure that your shop's order processing system is working correctly. This is important because you want to be sure that your customers will be able to place orders on your site and that they'll receive the correct items promptly. If not, you could end up with frustrated customers who may never order from you again.

Second, you'll want to test orders on Shopify to ensure that your customers will have a positive experience when they place an order on your site. This is important because you want your customers to be happy with their purchase and to feel confident that they made the right decision in choosing your shop.

Third, you'll want to test orders on Shopify to verify that your shop can handle large or complex orders. This is important because you want to be sure that your shop can handle the volume of traffic and orders that it may receive during busy times. By testing orders on Shopify, you can ensure that your shop will be able to handle the demands of your customers.

Shopify lets you check that you've implemented the correct order procedure, shipping, tax settings, and inventory management and that they're all operating effectively.

It's free for Shopify business owners to place a Shopify test order. This fact implies that any returned or canceled orders are not paid or incur a transaction charge. You should put at the very least a Shopify test order during the shop setup or update your payment options.

Setup your test environment in Shopify

Now that you've decided to take the plunge and set up a Shopify test environment, there are a few things you'll need to do in order to get started. In this section, we'll walk you through how to set up your Shopify test environment step-by-step so that you can start testing your Shopify store before going live.

Enter test mode

Before starting to test, we need to create a test environment. Payments cannot be tested in production (your live environment) since this would need an actual payment method to be set up. Instead, you can use test mode to simulate transactions without actual money-changing hands.

For premium clients, Shopify offers a feature called Test Mode in Shopify Payments. Shopify has also developed a solution for non-premium clients called Bogus Gateway.

To add the Bogus Gateway as a payment provider, go to Settings > Payment Providers and select Add a Provider. Click Bogus Gateway from the drop-down box under Third-Party Credit Card Provider. Shopify will next offer instructions on how to utilize this approach.

Test payment methods

Now you have to enter your credit card information. If you're utilizing the Bogus Gateway technique, all you have to do is choose the yellow B option for payment method and enter 1, 2, or 3 as credit card details, depending on what you're testing.

You'll want to test credit card information if you're operating in test mode. You must test both successful and failed transactions to ensure the message sent to clients upon payment is authentic.

You can accomplish this by using the simulation data offered by Shopify which we will discuss in successful and failed transactions.

Successful transactions

To create a successful purchase, provide the following information when requested for your credit card information throughout the checkout process:

  1. Enter a minimum of two words for your card's name.

  2. Enter any date of the future as the expiration date.

  3. Enter any three digits as your security code.

  4. Use any of the following digits as the card number:

Card type

Test credit card number

Visa

4242424242424242

Mastercard

5555555555554444

American Express

378282246310005

Discover

6011111111111117

Diners Club

30569309025904

JCB

3530111333300000

Failed transactions

Suppose you wish to examine the credit card error messages a customer would receive at checkout. In that case, you can use the following test credit card numbers to replicate various failed transactions:

Automate your test orders and payments on Shopify

Automated testing can reassure you that your website and payment setup are always fully functional. Test automation allows you to plan and execute business-critical procedures like payment regularly rather than manually testing them every now and then.

Test automation eliminates time-consuming testing activities and assists in ensuring quality. It may even provide you with a competitive edge by enhancing consumer experiences. They can test hundreds of scenarios in a matter of seconds; you no longer need to test everything manually. It allows you to experiment using data sets. If automation is on your company's broader plan because you want to experience the advantages of higher productivity, cost savings, and risk reduction, you may also want to invest in an automation solution.

By far the simplest method to begin automated testing is using UIlicious. Individuals with little background in test automation may use this automation tool to quickly automate their most repeated tests. Since this all-in-one tool is so powerful and adaptable, it enables anybody to quickly and easily write any automated test they can imagine.

You can test orders and payments using UIlicious.You just need to sign up and then edit the script code you will find below as per your shop UI elements to test your Shopify store's orders and payments. As a demonstration, you may also create your own test script on the site.

Sign up for UI-licious now

Example: How to easily automate tests on Shopify using UIlicious

In this example, we'll show you how to use UIlicious to simply automate testing on Shopify.

After reading this section, you will be able to automate tests like this one:

The idea of this test was to make sure that using the wrong card number will prompt an error message to the user before they can check out.

This automation was made possible only by writing the following script in UIlicious:

//Navigate to site
I.goTo("https://www.tentree.ca/")

//Choose something to buy and checkout
I.hoverOn("Women")
I.click("New Arrivals")
I.click("Golden Spruce Crop T-Shirt")
I.click("HI RISE GREY HEATHER")
I.click("M")
I.click("Add To Cart")
I.click("Checkout")

//Fill in needed details
I.fill("Email", "[email protected]")
I.fill("First Name", "Samantha")
I.fill("Last Name", "Smith")
I.fill("Address", "Sample Address")
I.fill("City", "Sample City")
I.select("Province", "Ontario")
I.fill("Postal Code", "M3H 0C3")
I.fill("Phone", "1234567890")
I.click("Continue To Shipping")
I.click("Proceed")

//Choose a shipping method
I.click("Standard Shipping")
I.click("Continue to payment")

//Choose payment method and fill in card information
I.click("Credit Card")
UI.context("iframe[title='Field container for: Card number']", ()=>{
	I.fill("Card Number", "4242 4242 4242 4242")
})
UI.context("iframe[title='Field container for: Name on card']", ()=>{
	I.fill("Name on card", "Samantha Smith")
})
UI.context("iframe[title='Field container for: Expiration date (MM / YY)']", ()=>{
	I.fill("Expiration date (MM / YY)", "12/27")
})
UI.context("iframe[title='Field container for: Security code']", ()=>{
	I.fill("Security Code", "123")
})
I.click("Pay Now")

//Check for errors
I.wait(10)
I.see("Card was declined")

Let's take a step-by-step look at what we're asking UIlicious to do in order to automate the buying journey to better understand how the above script is built.

First, we need to ask UIlicious to start by going to a web page. In this example, we start the test with the homepage because we want to test an end-to-end scenario. To do this, we use the I.goTo command which allows a web page to be loaded directly from its URL.

//Navigate to site
I.goTo("https://www.tentree.ca/")

Next, we want to navigate the site to a product page and add it to our basket. To do this, we use two different commands:

  1. I.hoverOn allows UIlicious to move the mouse cursor over an element on the page. On this page, we want to open a mega menu that can only be accessed by hovering over the name of the linked shop category. That's why we use it at the beginning of this example.

  2. I.click, as its name suggests, allows you to click on an element of the page. In our example, we use it to click on links and buttons. For example, on the product page, this command allows us to select the size of the product as well as to add it to the basket by clicking on a button.

Then after selecting the product, we click on the "Checkout" button.

//Choose something to buy and checkout
I.hoverOn("Women")
I.click("New Arrivals")
I.click("Golden Spruce Crop T-Shirt")
I.click("HI RISE GREY HEATHER")
I.click("M")
I.click("Add To Cart")
I.click("Checkout")

In the section below, the ten or so lines of script consist of the commands I.fill, which fills in fields, and I.select, which allows you to choose an option from a drop-down menu.

These lines are used to complete the customer's details, such as name, address, and telephone number.

Once we have finished filling in the form, we click on the buttons that allow us to continue the purchasing process.

//Fill in needed details
I.fill("Email", "[email protected]")
I.fill("First Name", "Samantha")
I.fill("Last Name", "Smith")
I.fill("Address", "Sample Address")
I.fill("City", "Sample City")
I.select("Province", "Ontario")
I.fill("Postal Code", "M3H 0C3")
I.fill("Phone", "1234567890")
I.click("Continue To Shipping")
I.click("Proceed")

In the two lines below we select only the payment method and then click on the button that allows us to continue the purchase process. All this using only the I.click command.

//Choose a shipping method
I.click("Standard Shipping")
I.click("Continue to payment")

In this part, we fill in the credit card information that needs to be inserted in an iFrame. To do this, we use the UI.context function. Then we click on the "Pay Now" button to continue the purchase process.

//Choose payment method and fill in card information
I.click("Credit Card")
UI.context("iframe[title='Field container for: Card number']", ()=>{
	I.fill("Card Number", "4242 4242 4242 4242")
})
UI.context("iframe[title='Field container for: Name on card']", ()=>{
	I.fill("Name on card", "Samantha Smith")
})
UI.context("iframe[title='Field container for: Expiration date (MM / YY)']", ()=>{
	I.fill("Expiration date (MM / YY)", "12/27")
})
UI.context("iframe[title='Field container for: Security code']", ()=>{
	I.fill("Security Code", "123")
})
I.click("Pay Now")

Finally, for the last part, we decide to wait for 10 seconds using the I.wait command. This wait gives Shopify enough time to display the error message that the card is declined. In fact, the last line of the script allows us to check that this error message is displayed by using the I.see command, which checks that a defined content is present on the web page where UIlicious is located.

//Check for errors
I.wait(10)
I.see("Card was declined")

If the Shopify e-commerce is perfectly set up, this test should be a success.

Conclusion

As you can see, a Shopify test order is required throughout the shop setup process. We hope that this detailed instruction on how to automate test orders and payments on Shopify enables you to carefully examine any issues and ensure that everything is functioning correctly for the benefit of your clients and yourself.

The order process, as well as the checkout process, is always important. If something doesn't go according to plan or if it's not working just right, then there are risks involved with every transaction- both financial risks when the payment goes through but also reputation risks when an issue arises at any time during an eCommerce customer's purchase journey which could lead them away.

UIlicious software makes testing orders and payments easier than ever before! You can test orders with UIlicious software to ensure that everything is functioning correctly for your client's benefit.

With UIlicious for Shopify, we provide a seamless testing experience that automates both test orders and payment so you don't have to worry about missing any crucial steps or forgetting how much money should be charged on an order - we take care of all this automatically with our product!

Sign up for UI-licious now

About Michael Da Silva

I'm a digital marketing expert and project manager passionate about automation. When I'm not automating tests and experiments on UIlicious, you can find me blogging about Japan, where I live, on Nipponrama.com.