From b1f5efcaad1468eb37e147ff266dfc3ddd40dee3 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 13:32:05 +0000 Subject: [PATCH] Changes Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com> --- supabase/functions/create-checkout/index.ts | 25 +++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/supabase/functions/create-checkout/index.ts b/supabase/functions/create-checkout/index.ts index 344d988..88a8261 100644 --- a/supabase/functions/create-checkout/index.ts +++ b/supabase/functions/create-checkout/index.ts @@ -144,19 +144,6 @@ Deno.serve(async (req) => { // Monthly amount in öre = kg × 4 veckor × 325 kr const monthlyAmountOre = Math.round(b.kg_per_week * WEEKS_PER_MONTH * PRICE_PER_KG_ORE); - // Resolve product via existing price lookup_key - const prices = await stripe.prices.list({ lookup_keys: ["kakabonnemang_dynamic"], limit: 1 }); - if (!prices.data.length) { - return new Response(JSON.stringify({ error: "Produkt inte konfigurerad" }), { - status: 500, - headers: { ...corsHeaders, "Content-Type": "application/json" }, - }); - } - const productId = - typeof prices.data[0].product === "string" - ? prices.data[0].product - : prices.data[0].product.id; - // Find or create customer const existing = await stripe.customers.list({ email: b.email, limit: 1 }); const customer = @@ -193,7 +180,11 @@ Deno.serve(async (req) => { quantity: 1, price_data: { currency: "sek", - product: productId, + product_data: { + name: "Kakabonnemang", + description: "Månatligt kakabonnemang för företag inom Storstockholm.", + tax_code: "txcd_40060003", + }, recurring: { interval: "month" }, unit_amount: monthlyAmountOre, } as any, @@ -242,7 +233,11 @@ Deno.serve(async (req) => { { price_data: { currency: "sek", - product: productId, + product_data: { + name: "Kakabonnemang", + description: "Månatligt kakabonnemang för företag inom Storstockholm.", + tax_code: "txcd_40060003", + }, recurring: { interval: "month" }, unit_amount: monthlyAmountOre, tax_behavior: "exclusive",