From 4d7d751edf747d704c1c32c9dd71383461c3f0e1 Mon Sep 17 00:00:00 2001 From: Winston Hsiao Date: Tue, 12 Nov 2024 19:19:55 -0500 Subject: [PATCH] Fix type checking? --- store/app/routers/stripe.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/store/app/routers/stripe.py b/store/app/routers/stripe.py index 2fe517e6..34a3a4fe 100644 --- a/store/app/routers/stripe.py +++ b/store/app/routers/stripe.py @@ -301,13 +301,12 @@ async def create_checkout_session( metadata["stripe_product_id"] = listing.stripe_product_id # Determine payment methods based on listing type and price - payment_methods = ["card"] + payment_methods: list[str] = ["card"] if listing.price_amount >= 5000 and listing.inventory_type != "preorder": - # Only add Affirm for non-preorder items payment_methods.append("affirm") # Base checkout session parameters - checkout_params = { + checkout_params: dict[str, Any] = { "line_items": [ { "price": platform_price.id, @@ -343,8 +342,9 @@ async def create_checkout_session( # Add setup_future_usage for preorders to save payment method if listing.inventory_type == "preorder": + if "payment_intent_data" not in checkout_params: + checkout_params["payment_intent_data"] = {} checkout_params["payment_intent_data"]["setup_future_usage"] = "off_session" - # Add custom text about saving payment info for preorders checkout_params["custom_text"] = { "submit": { "message": (