Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 18:16:42 +00:00
co-authored by renee-png
parent e6aa72c691
commit 60e4dedb1b
+4 -4
View File
@@ -51,13 +51,13 @@ export const createPaymentRequest = createServerFn({ method: "POST" })
},
)
.handler(async ({ data, context }) => {
const { userId } = context;
const { userId, supabase } = context;
const stripe = getStripe();
const { totalCents, feeCents } = calcSurcharge(data.base_amount_cents);
const origin = getOrigin();
// Insert pending row first
const { data: row, error: insErr } = await supabaseAdmin
// Insert pending row first (uses authenticated client; RLS allows insert by auth users)
const { data: row, error: insErr } = await supabase
.from("payment_requests")
.insert({
recipient_name: data.recipient_name,
@@ -110,7 +110,7 @@ export const createPaymentRequest = createServerFn({ method: "POST" })
metadata: { payment_request_id: row.id },
});
await supabaseAdmin
await supabase
.from("payment_requests")
.update({
stripe_session_id: session.id,