Firebase Cloud Functions - Stripe Connect Webhook not firing

落爺英雄遲暮 提交于 2021-02-05 11:43:31

问题


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:

2) set up Webhook endpoint with firebase URL

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


回答1:


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.



来源:https://stackoverflow.com/questions/60417848/firebase-cloud-functions-stripe-connect-webhook-not-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!