WooCommerce Stripe Test mode

So I've been integrating WooCommerce with Stripe checkout and set everything up correctly, but when it comes to paying I get this response after hitting 'Place Order':

No such customer: 'cus_Hu9exn9bPLd3SA'; a similar object exists in test mode, but a live mode key was used to make this request.

I've set the test mode keys (and client ID) correctly in the backend - set woocommerce to 'enable test mode'. Everything seems ok. When viewing stripe test mode it creates the customer correctly as well, but its almost as if its 'redirecting' or 'reporting' back a live mode key or something?

Manually checked the source and definitely test mode keys there (its obviously working as its creating the customer in test mode as well). Looking at the webhook attempts it does this:

So thats obviously working. But when it comes to 'charging' it seems to fail. In WooCommerce orders it shows 'pending payment'.`

Any help appreciated :?

Thanks

Nick

Topic woocommerce-offtopic e-commerce Wordpress

Category Web


If you're sure that your keys and mode are correct, use this SQL to delete attached stripe customer ids (which are now obsolete) from users:

DELETE * FROM `wp_usermeta` WHERE `meta_key` LIKE ‘_stripe_customer_id’

Ok so after much head scratching and log diving I realised the issue here. The site is a multi-vendor site and the connection to the vendor is with live keys. So although it creates a customer in test, it then tries to charge the user 'x' amount to the vendor with the vendors live test keys.

Left here for anyone else scratching there head on this bespoke scenario.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.