Stripe & Staging testing

Hi!

I am currently setting up a new product line for my company. Basically it is a micro SaaS offering within our main product features. I’ve created a subscription funnel, very simple and at the end I have the stripe integration to handle the subscription.

I am having a hard time testing this on staging.

Here is what I tried

  1. Using test price_ids from stripe:
  • I create the payment intent (using the test mode product_ids from stripe)
  • I add the test card details (42424 etc.)
  • I confirm the payment
  • Upon confirmation I get an error from stripe saying "No such price: 'price_XXXXXXXX'; a similar object exists in test mode, but a live mode key was used to make this request."
  1. Using live price_ids
  • I create the payment intent (using the test mode product_ids from stripe)
  • I add the test card details (42424 etc.)
  • I confirm the payment
  • Upon confirmation I get an error from stripe saying Your card was declined. Your request was in live mode, but used a known test card.

So it appears to me that I have an issue with the staging environment not taking the test API keys.

How would you handle it?

I thought of using a deployment variable, but I am having a hard time finding the stripe test API keys.

1 Like

Hi @Gauthier1 ,

Just to confirm: are you having trouble testing Stripe in preview mode when you’re working in the WeWeb editor or on a project that you published in WeWeb on the staging environment?

When you setup the Stripe plugin in WeWeb, you’re invited to add 4 API keys:

  • 2 production keys (public and private), and
  • 2 test keys (public and private).

The test keys are used when you’re working in the WeWeb Editor.

When you publish your app, whether you publish it to the staging environment or promote it to production, the production keys are used.

If you wish to continue using the test keys on a published app, you can add the test keys in the 2 fields normally reserved for the production keys in the Stripe plugin.

Does that help?

Hi @Joyce thank you for the answer, initially I wanted to test on staging using the test keys from stripe. But indeed I’ll update the production key in weweb with the test keys from Stripe.

Thanks for the help

1 Like