Just Launch It

Just
Launch
It

Features Payments

Setup

1. Create a new account on Stripe and activate payments.
2. In your Settings > Public Details, add your website URL.
3. Set your business logo and colors under Settings > Branding.
4. Turn on emails for successful payments and refunds under Settings > Customer Emails.
5. In Settings > Customer Portal, activate link to customer portal.
6. Search for "rules" in the search bar and set up rules under Fraud Prevention > Rules. Make sure the first 3DS rules are enabled at a minimum, and it is recommended to block payments if CVC fails.
7. Turn on Test Mode at the top, and create a new product and price. Once created, copy the price ID into your src/lib/just-launch-it.config.ts file.
8. In Developers > API keys, copy your secret key into your .env file as SECRET_STRIPE_KEY=sk_....
9. In Developers > Webhooks > Add endpoint, add your endpoint URL as https://your-domain.com/webhooks/stripe. Select the following events to listen to:
  • customer.subscription.created
  • customer.subscription.updated
  • customer.subscription.deleted
  • checkout.session.completed
  • invoice.paid
  • invoice.payment_failed
You may optionally add any other relevant events for your business needs.
10. Click Add endpoint.

Create a checkout

From the frontend, use the <CheckoutButton> component to create a new checkout session for a given price ID.

src/routes/checkout/+page.svelte

1import justLaunchItConfig from '$lib/just-launch-it.config';
2
3<CheckoutButton priceId={justLaunchItConfig.stripe.products[0].priceId} />

Stripe webhooks & subscription handling

Out of the box, Just Launch It comes with a pre-configured Stripe webhooks for handling checkout as a registered user purchasing a product as a one-off or with a recurring subscription.
Subscription or purchase state is conveniently handled for you and available on any authenticated request via the hasAccess local variable.
It is recommended to review and adjust the webhooks to suit your business needs at src/routes/webhooks/stripe/+server.ts