0

So when i'm going to create a stripe payment with firebase extension it shows me error of CollectionRefrence.doc()...any suggestion guys ?

Here is my code :

import React from 'react';
import getStripe from './stripe';
import firebase from 'firebase/app';
import 'firebase/firestore';
import Button from 'antd'

export const createCheckoutSession = (uid) => {

 let firestore = firebase.firestore()
    
            const checkout_sessionsRef =  firestore
            .collection('profiledata')
            .doc(uid)
            .collection('checkout_sessions')
            .add({
                price : 'price_1IGEdTKDPaWWeL1ymwWH5Ubb',
                success_url :window.location.origin,
                cancel_url:window.location.origin,
            });
        
            checkout_sessionsRef.onSnapshot(async (snap) => {
                const {sessionId} =snap.data();
                if (sessionId ){
                    const stripe = await getStripe();
                    stripe.redirectToCheckout({sessionId})
                }
            })


    return (
        <div>
           <createCheckoutSession/>
           <Button type="primary" htmlType="submit" id="submitButton">Register</Button>
        </div>
    )
}

export default createCheckoutSession;
Nolan H
  • 6,205
  • 1
  • 5
  • 19
neel
  • 29
  • 3
  • It seems that `uid` is an object in this call `.doc(uid)`, while Firestore requires for it to be a simple string value. It's hard to say why that is without seeing how you call this function. – Frank van Puffelen Mar 10 '21 at 16:36
  • This appears to be an issue with the firebase client/api, not with Stripe, so unfortunately I can't be of much help. – Nolan H Mar 10 '21 at 16:49

0 Answers0