Guides

Stripe payments in ten minutes

Connect Stripe, ask Nest for one-off passes or subscriptions, test with a dummy card and go live, with webhooks and receipts handled for you.

Lena Fischer & Theo Marchetti

A hand tapping a card on a payment terminal against a blue and orange background
Photo: Towfiqu barbhuiya / Pexels

Taking payments used to be the point where a weekend project stalled. You needed a checkout page, a webhook endpoint, a way to record who paid and a plan for failed cards. In Nest, all of that is one conversation. This guide walks through it from start to finish, and most people finish in about ten minutes.

Step 1: Connect your Stripe account

Open your project, go to Settings > Integrations and choose Stripe. You will be sent to Stripe to sign in or create an account, then returned to Nest. That is the whole setup.

Nest stores your keys as encrypted secrets on the server. They never appear in your client code, and they are not visible to anyone you invite to the project unless you give them admin access. Test and live keys are kept separately, so you can build safely before you charge anyone.

You can see every supported service on the integrations page.

Step 2: Ask for what you sell

Now tell Nest what you want to charge for, in plain language. Be specific about prices, billing periods and what a payment unlocks. A few examples:

  • “Sell a 10-class pass for $90. Each booking uses one class.”
  • “Add a Pro plan at $12 a month or $120 a year. Only Pro members can export reports.”
  • “Let people tip any amount on a creator’s page.”

Here is what each kind of ask sets up behind the scenes.

What to ask What Nest sets up
A one-off product or pass A Stripe price, a Checkout Session, and a purchases table updated on payment
A monthly or yearly plan A subscription price, a customer portal link, and a plan field on each user
A free trial Trial days on the subscription and a reminder email before it ends
Gated features A server-side check on every protected route, not just a hidden button

If you leave something out, like whether a plan has a trial, Nest will ask rather than guess.

Step 3: Look at what it built

Nest writes ordinary TypeScript, so you can read every part of the payment flow. A typical server function for a one-off purchase looks like this:

import { stripe } from "@/lib/stripe";
import { requireUser } from "@/lib/auth";

export async function createCheckout(passId: string) {
  const user = await requireUser();

  const session = await stripe.checkout.sessions.create({
    mode: "payment",
    customer_email: user.email,
    line_items: [{ price: passId, quantity: 1 }],
    metadata: { userId: user.id },
    success_url: `${process.env.APP_URL}/account?paid=1`,
    cancel_url: `${process.env.APP_URL}/passes`,
  });

  return session.url;
}

The user is checked on the server, the price comes from Stripe rather than the browser, and the user’s ID travels in the metadata so the webhook knows who paid.

Step 4: Test it

While your project uses test keys, no real money moves. Open the preview, click Buy, and pay with Stripe’s test card:

  • Card number 4242 4242 4242 4242
  • Any future expiry date
  • Any three-digit CVC and any postcode

After payment, you land back in your app and the pass or plan appears on your account. To check unhappy paths, use Stripe’s test card for a declined payment and confirm that nothing is unlocked.

Webhooks are handled for you

The part people usually get wrong is the webhook: the message Stripe sends to your app when a payment succeeds, a subscription renews or a card fails. Nest creates the endpoint, registers it with Stripe, verifies every signature and updates your database. Renewals, cancellations and failed payments are all covered. You do not need to copy a signing secret or deploy anything by hand.

You can see each event in the project logs, which is useful when you want to confirm a test went through.

Step 5: Go live

When you are happy with the flow, switch the project from Test to Live in the Stripe settings and publish. Nest swaps in your live keys, registers a live webhook and keeps your test data separate.

Before you flip the switch, it is worth a final check:

  1. Your prices and currencies are correct in the Stripe dashboard.
  2. Your app has a terms page and a way to contact you.
  3. You have bought something yourself with a real card and refunded it.

That is it. Your app is now taking payments on its .nest.app address or your own domain, and every charge, refund and payout shows up in Stripe as usual.

If you are building a product to sell, our page for founders has more on what to set up next, and the templates include a few starting points with payments already wired in.

#stripe#payments#guides
Portrait of Lena Fischer

Written by

Lena Fischer

Head of Community

Portrait of Theo Marchetti

Co-author

Theo Marchetti

Co-founder and CTO

Streaks of purple and green light curving through a dark frame

Product

Introducing Agent mode

Nest can now plan a change, make it across your whole project, test it in a real browser and fix what breaks before handing the app back to you.

A team cheering around laptops at a meeting table in a bright office

Company

Our $48M Series B

Nest has raised a $48M Series B led by Harbourline Ventures. Here is where we are, what the money is for and what stays the same.

Type to search every post.