0

[enter image description here][I I used Cloud Functions to process payments using stripe.But I encountered the following error.How to connect to stripe??

and this is my index.js file

const  https = require( 'firebase-functions');
const functions = require('firebase-functions');
const Firestore = require('@google-cloud/firestore');
const firestore = new Firestore();
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.helloUser = functions.firestore
    .document('stripetoken/{tokenId}')
    .onCreate(event =>{
    //var tokendata = event.data.data();
    var tokenId = event.params.tokenId;
    const stripe = require("stripe")("sk_test_l3ehpEzKMk4EAGZQ0QS64vgO")
     stripe.customers.create({
            email: "galladivya3@gmail.com",
            source: tokenId,
            }).then(function(customer) {
  // YOUR CODE: Save the customer ID and other info in a database for later.
  return stripe.charges.create({
    amount: 1000,
    currency: "usd",
    customer: customer.id,
  });
}).then(function(charge) {
  // Use and save the charge info.
});

    });
Divya Galla
  • 513
  • 1
  • 9
  • 31

1 Answers1

2

If you look further down the logs, you'll see that there's a note about having not configured billing, so you aren't allowed to make external network calls.

floatingLomas
  • 8,553
  • 2
  • 21
  • 27