Appbricx
Docs
FeaturesPricingStart free

Get started

OverviewWhat Appbricx isQuickstart with a coding agentQuickstart with the builderCore concepts

Guides

Data and tablesAccess and rolesBusiness rulesSign-inCustom screensRealtime and topicsWorkflows, schedules and webhooksServer functionsAI in your appPaymentsFilesMessagesIntegrationsVerifyPublishing, domains and rollbackOperating your appExport and self-hostSelf-host install

Tutorials

Build a booking app with Claude CodeMulti-user todo listClient portalSlack on new sign-upTemplates

Reference

Reference homeFrontend SDKHTTP APIMCP toolsCLIIntegrations catalogContract formatAI key resolutionRun Appbricx locally

Payments

Take payment for an order row: offline (pay at pickup) always, card through the owner's connected Stripe account. The amount is always computed on the server from the order's line rows.

5 membersSDK referenceGuide: Payments

On this page
  1. app.pay
  2. app.pay.methods
  3. app.pay.checkout
  4. app.pay.confirm
  5. app.pay.returned
  6. app.pay.status
  7. Types

Payments act on the contract's basket: an order entity, its line entity and the catalog price field. Create the order and its line rows first, then check out.

app.pay

app.pay.methodsmethod

What the app accepts right now: always "offline", plus "card" once the owner has connected Stripe.

app.pay.methods(): Promise<Array<"offline" | "card">>
Returns
Array<"offline" | "card">. Falls back to ["offline"] when the runtime has no payment plane.
Errors
Does not throw.
Permissions
Any caller of the app.
Example
const methods = await app.pay.methods();
const canPayByCard = methods.includes("card");

RelatedGET /__appbricx/pay/methods

Source: packages/appkit/src/kits/primitives/app-handle.ts:141

app.pay.checkoutmethod

Record payment for an order row. "offline" records it as due. "card" creates a Stripe Checkout session and sends the user to Stripe; they come back to this page with ?appbricx_pay=success&order=<id>, where you call confirm. If a card payment can't be started the order stands and is recorded as offline with a note.

app.pay.checkout(orderEntity: string, orderId: string, method?: "offline" | "card"): Promise<AppCheckout>

Parameters

NameTypeDescription
orderEntityrequiredstringThe contract's order entity (the basket's order table).
orderIdrequiredstringThe order row's id.
methodoptional"offline" | "card""offline" (default) or "card".
Returns
AppCheckout: { method, status ("due" or "processing"), amountCents?, fallback?, note? }. amountCents is the total the server computed from the order's line rows times catalog prices.
Errors
  • "payments aren't available in this preview" without a runtime.
  • The server's message: NOT_AN_ORDER (the table isn't the basket's order entity), ORDER_NOT_FOUND (the caller can't read the order), BAD_REQUEST.
Permissions
The caller must be able to read the order through row-level security. The browser never sends an amount.
Example
const order = await app.create("orders", { note });
for (const line of cart) await app.create("order_lines", { order: order.id, item: line.id, qty: line.qty });
const res = await app.pay.checkout("orders", String(order.id), "card");
if (res.fallback) setNotice(res.note ?? "Pay at pickup.");

RelatedPOST /__appbricx/pay/checkoutapp.pay.confirmapp.pay.returned

Source: packages/appkit/src/kits/primitives/app-handle.ts:146

app.pay.confirmmethod

Back from Stripe: asks Stripe about the order's open card payment and marks it paid, failed or still processing.

app.pay.confirm(orderEntity: string, orderId: string): Promise<string>

Parameters

NameTypeDescription
orderEntityrequiredstringThe order table.
orderIdrequiredstringThe order id.
Returns
The status: "paid", "failed" or "processing".
Errors
  • "card payments aren't available in this preview".
  • ORDER_NOT_FOUND, NO_CARD_PAYMENT, STRIPE_NOT_CONNECTED (503), STRIPE_ERROR (502), PAYMENT_MISMATCH (the Stripe session belongs to another order).
Permissions
Only someone who can read the order may confirm it, and the answer comes from Stripe, never from the browser.
Example
const back = app.pay.returned();
if (back?.status === "success") {
  const status = await app.pay.confirm("orders", back.orderId);
  setPaid(status === "paid");
}

RelatedPOST /__appbricx/pay/confirmapp.pay.returned

Source: packages/appkit/src/kits/primitives/app-handle.ts:149

app.pay.returnedmethod

On the page Stripe sent the user back to: which order, and whether they paid or cancelled. Reads ?appbricx_pay and ?order from the URL.

app.pay.returned(): { status: "success" | "cancelled"; orderId: string } | null
Returns
{ status: "success" | "cancelled"; orderId } or null on any other visit.
Errors
Does not throw.
Permissions
Reads the URL only. A "success" here is a claim: confirm asks Stripe.
Example
useEffect(() => {
  const back = app.pay.returned();
  if (back?.status === "cancelled") setNotice("Payment cancelled. Your order is saved.");
}, [app]);

Relatedapp.pay.confirm

Source: packages/appkit/src/kits/primitives/app-handle.ts:152

app.pay.statusmethod

The order's latest payment.

app.pay.status(orderEntity: string, orderId: string): Promise<AppPayment | null>

Parameters

NameTypeDescription
orderEntityrequiredstringThe order table.
orderIdrequiredstringThe order id.
Returns
AppPayment { method, provider, status, amountCents, currency, createdAt }, or null when none is recorded.
Errors
  • "payment status isn't available in this preview"; ORDER_NOT_FOUND when the caller can't read the order.
Permissions
Gated on reading the order row through row-level security.
Example
const p = await app.pay.status("orders", id);
if (p) setLabel(`${(p.amountCents / 100).toFixed(2)} ${p.currency.toUpperCase()} · ${p.status}`);

RelatedGET /__appbricx/pay/for/:table/:id

Source: packages/appkit/src/kits/primitives/app-handle.ts:154

Types

type AppCheckout = {
    method: "offline" | "card";
    status: string;
    amountCents?: number;
    fallback?: boolean;
    note?: string;
}

Source: packages/appkit/src/kits/primitives/app-handle.ts:118

type AppPayment = {
    method: string;
    provider: string | null;
    status: string;
    amountCents: number;
    currency: string;
    createdAt: string;
}

Source: packages/appkit/src/kits/primitives/app-handle.ts:127

On this page

  1. app.pay
  2. app.pay.methods
  3. app.pay.checkout
  4. app.pay.confirm
  5. app.pay.returned
  6. app.pay.status
  7. Types
Appbricx

The backend, runtime and hosting for apps your coding agent builds. On our cloud, in yours, or on your own servers.

Features

Coding agents and MCPVerify testingBuilder consolePostgres databaseData APIRealtimeRow-level securitySign-in and authPaymentsWorkflows and jobsAI in your appIntegrationsBackups and rollbackHosting and domainsSelf-host and exportAll features

Product

ShowcasePricingFor coding agentsTemplatesPrivate cloudBring your own AI keyFAQ

Compare

Appbricx vs SupabaseLovable alternativeBolt alternativeFor freelancersFor agencies

Resources

DocumentationReferenceBlogSupportContact

© 2026 Appbricx. All rights reserved.

TermsPrivacyCookiesAcceptable Use