Frontend Accelerator
Frontend Accelerator
  • Getting Started
    • Welcome
    • Start right now 👉
  • Setup
    • Database
    • Payments
    • Authentication
    • AI
  • Features
    • Dashboard
    • Localization
    • Changelog
    • Rich text editor
    • Lead magnet
    • Checkout button
    • Sign in button
    • Sales countdown banner
    • Capture email button
    • Locale switcher
    • Social icons
  • Extra
    • Theming
    • Support
Powered by GitBook
On this page
  • Stripe 💰
  • LemonSqueezy 🍋
  • Webhooks (payment)
  1. Setup

Payments

PreviousDatabaseNextAuthentication

Last updated 3 months ago

Supported providers:

Stripe 💰

  1. Create Stripe account:

  2. Important to note. You can switch between "live" and "test" environment with the following toggle. API keys you generate, products you create etc., are bound to the environment you create them in. So if you create API key in test, it won't exist in "live". Same goes for products, coupons, etc.

  3. Create public and secret key test:

  4. Create webhook key in test:

  5. Set .env variables: STRIPE_PUBLIC_KEY=pk_... STRIPE_SECRET_KEY=sk_... STRIPE_WEBHOOK_SECRET=whsec_... Note: Public key is prefixed with "pk", secret key with "sk" and webhook secret with "whsec".

  6. When creating a webhook select a route which handles these, in our case it's: /api/webhook/payment and select events you want to recieve, example:

  7. If you want to know how to test webhooks locally, without having website online, checkout this section.

  8. Now your Stripe setup is ready and you can add products :) Further documentation:

LemonSqueezy 🍋

  1. When creating a webhook select a route which handles the incoming events, in our case it's: /api/webhook/payment and select events you want to recieve (see picture above). If you want to know how to test webhooks locally, without having website online, checkout this section.

  2. Set .env variables: LEMON_SQUEEZY_API_KEY= LEMON_SQUEEZY_WEBHOOK_SECRET=

Webhooks (payment)

Webhook allow external services, in this case payment provider, to notify your application when specific events occur, such as successful payments.

Your application listens for incoming webhook events at this route:

/api/webhook/payment

Testing webhooks locally

  1. Configure your webhook sender (e.g., Stripe) to send events to this URL.

  2. Install CLI globally: npm install -g @webhooksite/cli

  3. Run the listener with the command: whcli forward --token=xxxxxxxxxxx --target=http://localhost:3000/api/webhook.payment (Note: make sure you use correct token. Also use http, rather then https)

  4. Make a "test" purchase to trigger the webhook

  5. Check the logs in webhook.site to see the payload being sent.

Create account:

Create api keys. API keys are bound to enviroment. API key created in "test" won't work in "production":

Create webhook key and signing secret:

Now your LemonSqueezy setup is ready and you can add products :) Further documentation:

Since webhooks are usually sent to public URLs, testing them locally requires a workaround. You can use to inspect and debug incoming webhooks and test them before going live.

Visit and copy the generated URL.

https://app.lemonsqueezy.com/dashboard
https://app.lemonsqueezy.com/settings/api
https://app.lemonsqueezy.com/settings/webhooks
https://docs.lemonsqueezy.com/guides/developer-guide/getting-started
webhook.site
webhook.site
https://dashboard.stripe.com/register
https://dashboard.stripe.com/test/apikeys
https://dashboard.stripe.com/test/webhooks
https://docs.stripe.com/keys
Stripe
LemonSqueezy