Skip to content

Commit

Permalink
Remove payment intent data for setup mode checkout session (#606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Winston-Hsiao authored Nov 15, 2024
1 parent fa13d34 commit 69a8316
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/gen/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ export interface paths {
put?: never;
/**
* Stripe Webhook
* @description Handle direct account webhooks (non-Connect events)
* @description Handle direct account webhooks (non-Connect events).
*/
post: operations["stripe_webhook_stripe_webhook_post"];
delete?: never;
Expand All @@ -945,7 +945,7 @@ export interface paths {
put?: never;
/**
* Stripe Connect Webhook
* @description Handle Connect account webhooks
* @description Handle Connect account webhooks.
*/
post: operations["stripe_connect_webhook_stripe_connect_webhook_post"];
delete?: never;
Expand Down
4 changes: 3 additions & 1 deletion store/app/routers/stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ async def create_checkout_session(
}

# Add payment intent data to save the payment method if it's new
if not existing_payment_methods:
if not existing_payment_methods and listing.inventory_type != "preorder":
checkout_params["payment_intent_data"] = {
**checkout_params.get("payment_intent_data", {}),
"setup_future_usage": "off_session",
Expand Down Expand Up @@ -485,6 +485,8 @@ async def create_checkout_session(
)
}
}
# Remove payment_intent_data if it exists
checkout_params.pop("payment_intent_data", None)
else:
# Regular payment mode
if not listing.stripe_price_id and listing.stripe_product_id:
Expand Down

0 comments on commit 69a8316

Please sign in to comment.