0

I'm trying to set up my stripe webhooks to fire invoking a firebase cloud function automatically whenever a Stripe Connect account is created, updated, or anything at this point. It only fires if I manually go to the Stripe Dashboard > Webhooks and hit the "send test webhook button".

so far what I've done:

1) created a Stripe Connect Webhook:

 Stripe Webhooks Dashboard

2) set up Webhook endpoint with firebase URL

enter image description here

3) set up node.js Firebase Cloud function to fire whenever stripe's webhook pings the Firebase URL.

const admin = require('firebase-admin');
const functions = require('firebase-functions');
admin.initializeApp(functions.config().firebase);
const stripeToken = require('stripe')(functions.config().stripe.token);
const stripeWebhooks = require('stripe')(functions.config().keys.webhooks);
const express = require('express');
const cors = require('cors');
const endpointSecret = functions.config().keys.signing;
const request = require('request-promise');
const app = express();

// Automatically allow cross-origin requests
app.use(cors({ origin: true }));

exports.stripeCreateOathResponseToken = functions.https.onRequest(cors((req, res) => {

    res.send("cloud function fired");

}));

What am I missing that doesnt let the Stripe Webhook fire automatically?

here are some of the tutorials I've been following:

https://medium.com/@koss_lebedev/stripe-webhooks-in-connect-applications-a7d71bdd44e1

https://github.com/GaryH21/Stripe-Webhooks-Tutorial/blob/master/functions/index.js

https://medium.com/@GaryHarrower/working-with-stripe-webhooks-firebase-cloud-functions-5366c206c6c

Cflux
  • 1,423
  • 3
  • 19
  • 39

1 Answers1

0

You have set this up as a Connect Endpoint. You'll need to make sure the events are actually occurring on connected accounts (and not your own platform account), as your own account's events won't get sent to a Connect Endpoint.

You can test this by creating a connected account and verifying that events from it get sent.

taintedzodiac
  • 2,658
  • 1
  • 18
  • 16
  • @tainedzodiac, so youre saying that my "2) set up Webhook endpoint with firebase URL" in the question above is incorrectly set up? – Cflux Feb 26 '20 at 17:09
  • 1
    @Cflux In your first screenshot, notice there are two sections: endpoints receiving events from your account, endpoints receiving events from Connect applications. It depends on the event and where it is coming from. See here: https://stripe.com/docs/connect/webhooks – Nolan H Feb 26 '20 at 20:06
  • @NolanH, Feel free to post this as the answer so I can mark it. I looked through the link you provided in your comment but I'm not seeing the difference between the "Endpoints receiving events from your account" category and the "Endpoints receiving events from Connect applications" category explained. Feel free to provide an explanation of how and why they differ. Examples of scenarios would also be helpful. – Cflux Feb 27 '20 at 04:41
  • @Cflux The first link in my previous comment includes documentation on the difference, and links to further docs at the bottom of the page. – taintedzodiac Feb 27 '20 at 18:03