Payments the browser can't fake.

A server action totals the order and asks Stripe or Razorpay for a checkout. The provider's signed webhook marks it paid.

workflows/stripe.ts
import { webhook } from "@appbricx/workflows";

// the signature is checked on the raw body first
export const stripeEvents = webhook("stripe-events", { verify: "stripe" },
  async ({ body }, step) => {
    const e = body as { type: string;
      data: { object: { client_reference_id: string } } };
    if (e.type !== "checkout.session.completed") return;
    await step.run("mark paid", () =>
      step.ctx.db.update("order", e.data.object.client_reference_id,
        { status: "paid" }));
  });
Stripe, or Razorpay for INR and UPI
Your account
An amount never comes from the browser
Server totals
Sent only to the provider's host
Keys by reference
Paid only when the provider says so
Signed webhooks

What you get

  • Your own account

    Your Stripe or Razorpay keys and prices. Appbricx takes no cut.

  • Server totals

    The action prices the order. A page never sends an amount.

  • Paid on the webhook

    Only the provider's signed webhook marks an order paid.

  • Razorpay for India

    INR by UPI, card or netbanking on Razorpay's page.

How checkout works

server/checkout.ts
import { defineAction, v } from "@appbricx/server";
import { stripeForm } from "./stripe-form";   // your own helper

export const checkout = defineAction({
  input: v.object({ order: v.uuid() }),
  roles: ["customer"],
  handler: async (ctx, input) => {
    // read as the caller: only their own order's lines come back
    const lines = await ctx.db.list("order_line", { where: { order_id: input.order } });
    const cents = lines.reduce((s, l) => s + Number(l.qty) * Number(l.unit_cents), 0);
    const res = await ctx.http.fetch("https://api.stripe.com/v1/checkout/sessions", {
      method: "POST",
      auth: { bearer: ctx.secrets.ref("STRIPE_SECRET_KEY") },
      headers: { "content-type": "application/x-www-form-urlencoded" },
      body: stripeForm({ order: input.order, cents }),
    });
    return { url: String(res.json<{ url: string }>()?.url) };
  },
});
Atelier, a marketplace for handmade goods, on desktop
Atelier records payments from a signed callbackOpen Atelier

Questions

Do payments go to my own Stripe account?

Yes. Your actions call Stripe with your own secret key, so customers pay on Stripe's own checkout page into your account.

My customers are in India. Can they pay with UPI?

Yes. Use Razorpay with your own keys: customers pay in INR on Razorpay's hosted page by UPI, card, netbanking or wallet, and Razorpay's signed webhook marks the payment paid.

Can a customer change the price in the browser?

No. The page sends only the order's id. The server totals the order from your prices, and only the provider's signed webhook marks it paid.

Ship it with your agent.

claude mcp add --transport http appbricx https://appbricx.com/api/mcp