Unable to handle Stripe Webhooks when client and server on different domains
Hi,
Firstly, thanks for an awesome library. I've stumbled across an issue and hoping if someone had any pointers. Currently trying to integrate Stripe with Organizations.
From a setup POV, we have the backend running Hono on CF Workers and for the frontend, we have a React + Vite (separate client and server)
For local testing, client: localhost:5173, server localhost:8787
When calling the
client.subscription.upgrade in the frontend, the Stripe checkout page is shown, we are able to do a checkout and the subscription is created successfully. We can see the subscription in Stripe and we can also see the webhooks being sent to the backend.
But, the subscription status is not getting updated in the database. It is still incomplete and the subscription_id is NULL. We also do not see any errors in the backend log, just one entry with HTTP 302 with the onSuccess callback URL pointing to the client origin
onSubscriptionComplete is also not being triggered in the plugin. When we test cancelling a subscription directly from Stripe, we see Stripe webhook error because the subscription id is not updated and is still NULL
1 Reply
Below is my plugin config on the backend: