nextjs-subscription-payments
nextjs-subscription-payments copied to clipboard
Products from Stripe Dashboard are not getting pulled in.
I swear I followed all the steps in the README exactly and I even used the stripe API to pull in all of the test products.

And I made sure that I used my test mode API keys. And for the STRIPE_WEBHOOK_SECRET I used the key given to me after running step 2 in the project locally...



I do not understand what I could have done wrong, Has anyone else had a similar experience when trying this starter? Or is anyone able to help me figure out what my issue is?
Thanks,
Chris
Im having the exact same problem.
YAY, it is not just me!
I'm also having a similar issue.
I am also having the same issue.
Still no ideas? Does anybody know an alternative starter?
I had the same problem and I solved it doing this: Products on this template are being retrieved from supabase. If you have RLS enabled in your tables, make sure you have at least a policy that allows read for all users. Here you have a link that mentions this problem: https://github.com/supabase/supabase/discussions/3780#discussioncomment-4095624
i solved the problem by putting the schema.sql into the supabase SQL-editor in order to generated the sql-tables. Somehow there were no Tables after installation of supabase. Afterwords you need to reconfig the product at stripe to get synced with supabase
Check supabase if you have tables: https://app.supabase.com/project/[YOUR_PROJECT_ID]/database/tables If not go to the sql editor: https://app.supabase.com/project/[YOUR_PROJECT_ID]/sql And run the contents of: https://github.com/vercel/nextjs-subscription-payments/blob/main/schema.sql
The integration is not running schema.sql like it should have
I ended up copying the contents of schema.sql and putting them into a migration file.
I ran yarn supabase migration new initial and yarn supabase db push to do this.
I still haven't figure this one out. Did anyone solve it? I am using google cloud for hosting :)
Hello, I'd like to help you get resolved if you have time to chat. I deployed yesterday, had working then decided after all the tips regarding webhooks, api on supabase and user profile additions to schema .db i would set out today from a fresh deployment. I have successful deployed and publishing products directly from stripe to project-name-vercel.com deployment.
I wanted to test the options needed to publish products from start to proof as quick as possible..
- I deployed from vercel dashboard
- checked all required api auth info: (see stripe dashboard)
- webhooks url = your-project-name.vercel.com
- webhooks Signing Secrets (whsec_***)
- Pub Key
- Secret Key
- url wildcard redirect - [ https://**vercel.app// ] added to (supabase.com/project/your-db-id-here/auth/URL-configuration)
- What I did different from instructions: I added supabase API Quick start to Stripe APi endpoint. I wanted to test updating from stripe to website. After successful connection of all dbs I'd move into local setup. FYI, I'd rather not modify products outside stripe..."if possible."
-
Copied schema data from local clone/ git-repo (for me it was easier to do in local clone) needed for supabase tables to communicate with stripe) note* I didn't make any local changes, no install or pushed to git repo.
-
Time to RE-Deploy & confirm environment was able to deploy with updated settings. Head to vercel dashboard and set to redeploy. (I watched the build steps for better understanding)
-
Successfully re-deployed!!!!
Now that the environment checks I added Profiles to supabase table editor. tip see supbase_docs
- Create table create table profiles ( id uuid references auth.users, avatar_url text );
- Enable RLS alter table profiles enable row level security;
- Create Policy create policy "Users can update their own profiles." on profiles for update using ( auth.uid() = id );`
- Head over to stripe dashboard Here you should make sure developer and test button are active.
- add 4 simple products with recurring pricing - simple data for testing, don't get fancy yet.
- refresh your domain ... https://your_project__name_here.vercel.app/
wahlah.. you should see products populated now.
Happy Coding -- if this helps please give me a star @mworks-proj
Together we are achieving more!
- webhooks url = your-project-name.vercel.com
should this be your-project-name.vercel.com/api/webhooks ?
I also had the same issue and ran schema.sql in the supabase sql editor, worked for me.
I ran the project on a different port (3001 instead of 3000) and that ended up working for me. I think its because I had cloned the project previously and listened for webhooks on port 3000. This is what worked for me, hope it helps.

I ran into the same issue.
I had the schema and RLS in Supabase fine.
I just went and updated the prices in Stripe and they showed up in my app. I think the order of the instructions is wrong, schema first, then local stripe webhooks, then set pricing with the Stripe cli.
Hi @mworks-proj I am struggling with this. Do you have time for a quick chat? Hi all, anyone who can help me? I still cant get the products to supabase Aswin
@OrionSeven's comment solved it for me.
The way the setup works, you need to have Supabase database spun up and the service running locally (or live) so that the Stripe webhook that is triggered when you create / update a product and product price hits your service and adds the product/prices to your Supabase database so it can be displayed.
You should see this:
Ideally, the server (on startup) would pull the most up to date products/prices and update the DB , in case products/prices were updated while the server was not running and missed the webhook.
Was banging my head against the desk over this issue, but the preceding comment nailed it, and I've got it working now. The problem is that the function to upsert products to the Supabase db is only being run when a POST is received from Stripe, and there's no logic to trigger a Stripe POST on initial page load. Instead, you have to trigger a post manually by editing your product on Stripe while your development server is running.
-
Make sure your Stripe and Supabase are set up, you have run schema.sql on the Stripe dashboard to create tables, and your .env.local is populated.
-
Run
stripe listen --forward-to=localhost:3000/api/webhooksin one terminal. -
In a second terminal, run
npm run devto start the development server. Wait for the development server to initialize and navigate to http://localhost:3000. -
Then, with both the listener and dev server running, you have to edit your Stripe product information. You can either: a) run
stripe fixtures fixtures/stripe-fixtures.jsonin a third terminal, or b) change your products manually on the Stripe dashboard.
You should now see the products populate on-page.
Hello @masapasa , were you able to get db working?
@mworks-proj yes, thanks
Was banging my head against the desk over this issue, but the preceding comment nailed it, and I've got it working now. The problem is that the function to upsert products to the Supabase db is only being run when a POST is received from Stripe, and there's no logic to trigger a Stripe POST on initial page load. Instead, you have to trigger a post manually by editing your product on Stripe while your development server is running.
- Make sure your Stripe and Supabase are set up, you have run schema.sql on the Stripe dashboard to create tables, and your .env.local is populated.
- Run
stripe listen --forward-to=localhost:3000/api/webhooksin one terminal.- In a second terminal, run
npm run devto start the development server. Wait for the development server to initialize and navigate to http://localhost:3000.- Then, with both the listener and dev server running, you have to edit your Stripe product information. You can either: a) run
stripe fixtures fixtures/stripe-fixtures.jsonin a third terminal, or b) change your products manually on the Stripe dashboard.You should now see the products populate on-page.
Thank you this really helped me.
This is still an issue. If someone updates their app and keeps the same Stripe account, the deploy does not allow Stripe to update Supabase. And you cannot run the schema again as there are conflicts. Any solutions would be greatly appreciated. thx
This is still an issue. If someone updates their app and keeps the same Stripe account, the deploy does not allow Stripe to update Supabase. And you cannot run the schema again as there are conflicts. Any solutions would be greatly appreciated. thx
What exactly is happening when you run the stripe listener and then update a product from Stripe? What do you see in your CLI, and what do you see in your Stripe dashboard logs?
Instead of running the schema.sql file, try running the migrations.
@chriscarrollsmith so I just updated my products and prices in order to get things working. But this method is not wise say later down the road. But for now, I am good.
What needs to happen is an event from Stripe needs to take place in order to propagate the Supabase DB.
What we need to figure out is how to trigger an event from Stripe that will send the product and pricing information from Stripe to the Supabase DB without having to update current product/prices and without having to create new product/prices as well.
Yes, that's exactly how it works if you have your webhook and webhook listener set up correctly. Make sure to follow the instructions for webhook setup in the README.
On Fri, Feb 16, 2024, 4:40 PM Guy Lepage @.***> wrote:
@chriscarrollsmith https://github.com/chriscarrollsmith so I just updated my products and prices in order to get things working. But this method is not wise say later down the road. But for now, I am good.
What needs to happen is an event from Stripe needs to take place in order to propagate the Supabase DB.
What we need to figure out is how to trigger an event from Stripe that will send the product and pricing information from Stripe to the Supabase DB without having to update current product/prices and without having to create new product/prices as well.
— Reply to this email directly, view it on GitHub https://github.com/vercel/nextjs-subscription-payments/issues/168#issuecomment-1949372825, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASCYPGOQECTDO3LKIRSFTX3YT7G6BAVCNFSM6AAAAAAUM4RCJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBZGM3TEOBSGU . You are receiving this because you were mentioned.Message ID: @.***>
Yeah. But we definitely need to figure out an alternative to be able to trigger an event from Stripe that will send the product and pricing information from Stripe to the Supabase DB without having to update current product/prices and without having to create new product/prices as well.
That's what I'm saying: the template already does that. As long as you have your webhook set up and are subscribed to the relevant events through the Stripe dashboard, and your template is deployed and listening for Stripe webhook events, any changes you make to products and prices from the Stripe dashboard will be automatically propagated to your Supabse database without any manual effort on your part. But you have to get both that webhook and the listener set up correctly, or it won't just be the price and product propagation that fails. You won't be able to process any transactions at all.
Unless you're saying you already have products and prices set up in Stripe but they're not propagated to Supabase, and you want to copy them over without making any changes to them? If you just missed the webhook events that created them, you can always go into the webhook logs on the Stripe dashboard and retrigger those events. But we don't currently have a way to do this programmatically. You could get then through the Stripe CLI and write a short script to copy them to Supabase. Eventually I'd love to add foreign data wrappers to this template, which would do what you want. But that's a big change to the architecture I think.
i keep getting invalid API Key, followed all other suggestions, my tables where automatically created upon installation too 😣
i've checked the API keys 1000 times. used stripe CLI for local webhook key and stripe in test mode for: STRIPE_SECRET_KEY NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
Authentication works and tables are updated, its just Stripe, main error: Error: Price insert/update failed: Invalid API key Supabase customer lookup failed: Invalid API key
i keep getting invalid API Key, followed all other suggestions, my tables where automatically created upon installation too 😣
i've checked the API keys 1000 times. used stripe CLI for local webhook key and stripe in test mode for: STRIPE_SECRET_KEY NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
Authentication works and tables are updated, its just Stripe, main error: Error: Price insert/update failed: Invalid API key Supabase customer lookup failed: Invalid API key
That sounds like a Supabase key problem rather than a Stripe key problem, but if authentication works and the tables are being updated then your Supabase key should be okay. (Maybe this is using service role key rather than anon key? I will check later today. In the meantime, try verifying that your Supabase service role key is correct.)