vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
5.79k stars 1.19k forks source link

Closes PR #200: Reconcile Supabase with Stripe in createOrRetrieveCustomer #274

Closed chriscarrollsmith closed 7 months ago

chriscarrollsmith commented 7 months ago

Fixes and closes #200, which fails if the customer already exists in both Supabase and Stripe.

The code in that PR looks a Stripe record and then tries to upsert a duplicate record to Supabase without checking if a Supabase record exists first, which raises an error if a Supabase record exists.

I refactored the code so it should perform reconciliation in all edge cases.

This is a fairly aggressive reconciliation process, but it should be robust and should help correct human errors caused by manually deleting database entries.

vercel[bot] commented 7 months ago

@chriscarrollsmith is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.