GitHunt
DE

desenna/today-server

Stripe Payments with Supabase Functions

This is an example server showing how to process payments with Supabase Functions for authenticated customers.

Demo gif

Setup

Create new Supabase project

Setup env vars

Supabase Functions

Supabase Functions are written in TypeScript, run via Deno, and deployed with the Supabase CLI. Please download the latest version of the Supabase CLI, or upgrade it if you have it already installed.

  • Generate access token and log in to CLI
  • Link your project
    • Within your project root run supabase link --project-ref your-project-ref

Develop locally

  • Run supabase start --debug (make sure your Docker daemon is running.)
  • Run supabase functions serve --env-file .env payment-sheet
    • NOTE: no need to specify SUPABASE_URL and SUPABASE_ANON_KEY as they are automatically supplied for you from the linked project.
  • Run the Chrome web extension separately (see https://github.com/tinyramenstudio/today-webext?tab=readme-ov-file#getting-started)
  • Make some test moneys ๐Ÿ’ฐ๐Ÿงง๐Ÿ’ต
  • Stop local development
    • Kill the "supabase functions serve watcher" (ctrl + c)
    • Run supabase stop to stop the Docker containers.

Deploy

  • Set up your secrets
    • Run supabase secrets set --from-stdin < .env to set the env vars from your .env file.
    • You can run supabase secrets list to check that it worked and also to see what other env vars are set by default.
  • Deploy the function
    • Within your project root run supabase functions deploy payment-sheet

๐Ÿ‘โšก๏ธ๐Ÿ‘

For more info on Supabase Functions, check out the docs and the examples.

desenna/today-server | GitHunt