If you clone a website to a staging site for testing purposes, you might worry about the customers’ live subscription payments being active on the cloned site, such that any upcoming payments have the potential risk of getting double-charged – once on the main, and once on the staging. Or are there in-built mechanisms in place to prevent this from happening?
The answer to this question is No. There is no potential risk of getting double-charged – once on the main, and once on the staging. Any payments made from the website are verified with the registered domains first and then processed. When any website is set up on a staging environment the website URL gets changed, hence while making the payment it will show an error.
What is considered a Staging Site?
Subscriptions by WooCommerce Payments will keep a record of the URL of the site where it is first activated. It considers this to be the live site and will run in live mode. If the site’s URL then changes, it considers the new site to be a staging site and it will run in staging mode.
This means if you first activate Subscriptions on a staging site, Subscriptions will run in live mode on the staging site because it considers this site to actually be your live site.
Because of this, if you want to test Subscriptions on a staging site before running it on your live site, we recommend first activating it on the live site and then creating the staging site from that site’s database.
Developer Note: WooCommerce Subscriptions stores an obscured clone of WordPress’ siteurl value in an option with the name wc_subscriptions_siteurl. It compares this value with the siteurl value to see if it has changed.
It is recommended to use Test mode while checking on the staging environment otherwise you could also use some coupons (eg. 100% off) in order to test payment and still not get money deducted.