Stripeで商品が重複作成される問題
Resolved 💬 2 comments Opened Aug 11, 2025 by rayramy04 Closed Aug 12, 2025
checkout/route.tsでStripe Checkoutセッションを作成する際に、line_itemsで商品情報を渡していますが、商品(Product)を明示的に作成していないため、Stripeが自動的に'myproduct'という名前の商品を作成している可能性があります。
現象
- Stripeダッシュボードで'myproduct'という名前の商品が複数作成される
- 価格は.00 USD、税カテゴリは'General - Electronically Supplied Services'
原因の推測
checkout.sessions.createのline_itemsにpriceIdのみを指定しているが、そのpriceIdに紐づく商品が存在しない場合、Stripeが自動的にデフォルト名で商品を作成している可能性がある。
解決策
- Stripe側で事前に商品(Product)と価格(Price)を作成し、正しいPriceIdを使用する
- または、line_itemsでprice_dataを使用して動的に価格情報を指定する
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗