Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
e6aa72c691
commit
60e4dedb1b
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user