Firebase Cloud Functions - Stripe Connect Webhook 未触发 [英] Firebase Cloud Functions - Stripe Connect Webhook not firing

查看:28
本文介绍了Firebase Cloud Functions - Stripe Connect Webhook 未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置我的 stripe webhook,以便在此时创建、更新 Stripe Connect 帐户或进行任何操作时自动调用 firebase 云功能.只有当我手动转到 Stripe Dashboard > Webhook 并点击发送测试 webhook 按钮"时它才会触发.

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) 创建了一个 Stripe Connect Webhook:

1) created a Stripe Connect Webhook:

2) 使用 firebase URL 设置 Webhook 端点

2) set up Webhook endpoint with firebase URL

3) 设置 node.js Firebase Cloud 函数,以便在 stripe 的 webhook ping 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");

}));

我错过了什么不会让 Stripe Webhook 自动触发?

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

推荐答案

您已将其设置为 连接端点.您需要确保事件确实发生在关联账户(而不是您自己的平台账户)上,因为您自己账户的事件不会发送到 Connect Endpoint.

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.

这篇关于Firebase Cloud Functions - Stripe Connect Webhook 未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆