title: Firebase charge function not being received by Stripe
body: <p>I'm working with charging credit cards on an ionic application. If I check the Stripe website, only the token is created successfully. There is no event for the charge.  When I check Firebase everything seems to be working (previously I had error message "An error occurred with our connection to Stripe" which was eliminated by upgrading to paid version Blaze). </p>
  
  <p>I've structured the following code so you can see the sequence of events.</p>
  
  <p>Here is the sequence of events: </p>
  
  <p><strong>1)</strong> Here I get the token and pass to <code>payByStripe</code> function:</p>
  
  <pre><code>checkOut() {
    let alert = this.alertCtrl.create({
      title: 'card information',
      cssClass:'alert-css',
      inputs: [{
        name: 'cardNumber',
        placeholder: 'card number',
      },
      {
        name: 'expMonth',
        placeholder: 'expMonth',
      },
      {
        name: 'expYear',
        placeholder: 'expYear',
      },
      {
        name: 'cvc',
        placeholder: 'cvc',
      }],
      buttons: [{
        text: 'Cancel',
        role: 'cancel',
        handler: data =&gt; {
          console.log('Cancel clicked');
        }
      },
      {
        text: 'PAY',
        handler: data =&gt; {
          this.stripe.setPublishableKey('pk_test_abcdef1BC');
          let card = {
            number: data.cardNumber,
            expMonth: data.expMonth,
            expYear: data.expYear,
            cvc: data.cvc
          };
          this.stripe.createCardToken(card)
          .then(token =&gt; {
            this.goodsData.payByStripe(this.totalMoniesPlusTaxAndCharge,this.userEmail,token);
              let alert = this.alertCtrl.create({
                title: 'Charged',
                cssClass:'alert-css',
                subTitle: 'Successful Charge!',
                buttons: ['Dismiss']
              });
              alert.present();
            }, error =&gt; {
              this.loading.dismiss();
              let alert = this.alertCtrl.create({
                title: 'ERROR',
                cssClass:'alert-css',
                subTitle: JSON.stringify(error),
                buttons: ['Dismiss']
              });
              alert.present();
            })
          .catch(error =&gt; console.log(JSON.stringify(error)) );
        }
      }]
    });
    alert.present();
  } 
  </code></pre>
  
  <p><strong>2)</strong> Here, I push the charge to Firebase, where cloud functions will handle it: </p>
  
  <pre><code>payByStripe(amount,email,token): firebase.database.Reference {
    return firebase.database().ref('/stripe_customers/charges/').push({
      amount:amount,
      email:email,
      token:token
    });
  }
  </code></pre>
  
  <p><strong>3)</strong> Here is what the cloud functions are doing: </p>
  
  <pre><code>const functions = require('firebase-functions'),
        admin = require('firebase-admin'),
        logging = require('@google-cloud/logging')();
  
  admin.initializeApp(functions.config().firebase);
  
  const stripe = require('stripe')(functions.config().stripe.token),
        currency = functions.config().stripe.currency || 'USD';
  
  // [START chargecustomer]
  // Charge the Stripe customer whenever an amount is written to the Realtime database
  exports.createStripeCharge = functions.database.ref('/stripe_customers/charges/').onWrite(event =&gt; {
    const val = event.data.val();
    // This onWrite will trigger whenever anything is written to the path, so
    // noop if the charge was deleted, errored out, or the Stripe API returned a result (id exists) 
    if (val === null || val.id || val.error) return null;
    // Look up the Stripe customer id written in createStripeCustomer
  
      // Create a charge using the pushId as the idempotency key, protecting against double charges 
      const amount = val.amount;
      const email = val.email;
      const token = val.token;
  
      stripe.charges.create({
        amount: amount,
        currency: "usd",
        source: token,
        description: "Charge for " + email
      }).then(response =&gt; {
        // If the result is successful, write it back to the database
        return event.data.adminRef.set(response);
      }, error =&gt; {
        // We want to capture errors and render them in a user-friendly way, while
        // still logging an exception with Stackdriver
        return event.data.adminRef.child('error').set(userFacingMessage(error)).then(() =&gt; {
          return reportError(error, {user: event.params.userId});
        });
      });
  });
  // [END chargecustomer]]
  </code></pre>