From 60e4dedb1beb03aa85ed97f357d672de8db2e121 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:16:42 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/lib/payments.functions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/payments.functions.ts b/src/lib/payments.functions.ts index 4a759c7..e21727d 100644 --- a/src/lib/payments.functions.ts +++ b/src/lib/payments.functions.ts @@ -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,