@@ -164,13 +164,12 @@ export const getStripePrice = async ({
164164 }
165165
166166 // Get Price
167+ console . debug ( 'query for strip-product' , id )
167168 const pricesQuery = await query (
168- collection (
169- doc ( collection ( getFirestore ( ) , "stripe-products" ) , id ) ,
170- "prices"
171- ) ,
169+ collection ( getFirestore ( ) , `stripe-products/${ id } /prices` ) ,
172170 where ( "active" , "==" , true )
173171 ) ;
172+ console . debug ( 'query' , pricesQuery )
174173 const pricesSnapshot = await getDocs ( pricesQuery ) ;
175174 const price = pricesSnapshot . docs [ 0 ] ;
176175
@@ -200,24 +199,24 @@ export const addSubscription = async ({
200199 collection ( userDoc , "checkout_sessions" ) ,
201200 stripeProduct
202201 ? {
203- line_items : [
204- {
205- price : price . id ,
206- quantity : 1 ,
207- } ,
208- ] ,
209- mode : "payment" ,
210- allow_promotion_codes : true ,
211- success_url : window . location . href ,
212- cancel_url : window . location . href ,
213- }
202+ line_items : [
203+ {
204+ price : price . id ,
205+ quantity : 1 ,
206+ } ,
207+ ] ,
208+ mode : "payment" ,
209+ allow_promotion_codes : true ,
210+ success_url : window . location . href ,
211+ cancel_url : window . location . href ,
212+ }
214213 : {
215- mode : "subscription" ,
216- allow_promotion_codes : true ,
217- price : price . id ,
218- success_url : window . location . href ,
219- cancel_url : window . location . href ,
220- }
214+ mode : "subscription" ,
215+ allow_promotion_codes : true ,
216+ price : price . id ,
217+ success_url : window . location . href ,
218+ cancel_url : window . location . href ,
219+ }
221220 ) ;
222221} ;
223222
0 commit comments