我正在尝试让Stripe Express Connect与我的Cloud Firebase功能一起使用。
到目前为止,我已经能够设置我的Android应用程序以打开浏览器,并使用一些预填写的表格开始注册过程,但是一旦我的客户通过特殊网址发送到完成的屏幕(使用测试模式)后,我无法在tutorial given之后从该URL中检索信息。我陷入了步骤4。
这些是我过去一周一直在寻找的资源,但似乎无法将它们放在一起
1)https://firebase.google.com/docs/functions/http-events#using_existing_express_apps
2)Parameters in Firebase Cloud Functions HTTPS
3)Stripe Connect Firebase Functions
[当前,我在Stripe中设置了一个Webhook,每当我手动执行云函数时都会得到响应,但是返回成功响应后,我无法获得状态或授权码值。
-----------------更新--------------------
这是我用来将它们发送到URL(已填写的连接表单)的代码
val openURL = Intent(Intent.ACTION_VIEW) openURL.data = Uri.parse( "https://connect.stripe.com/express/oauth/authorize?" + "redirect_uri=http://YourNeighborsBookshelf.com&" + "client_id=ca_32D88BD1XXXXXXXXXXXXXXXXXXXXXXXXXX&" + "state=" + mAuth.currentUser!!.uid + "&stripe_user[email]=" + userEmail + "&stripe_user[phone_number]=" + userPhoneNumberStripped + "#/") startActivity(openURL)
----------更新结束---------------
这里是我试图从中获取代码和状态值的URL
https://connect.stripe.com/connect/default/oauth/test?code=ac_XXXXXXXXXXXXXXXXX&state=YYYYYYYYYYYYYYY
这是我在Stripe函数中遇到的错误:
Test webhook error: 500 Response Error: could not handle the request
这是我在firebase函数日志中得到的错误:
Error: Invalid JSON received from the Stripe API at IncomingMessage.res.once (/srv/node_modules/stripe/lib/StripeResource.js:182:13) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:139:11) at process._tickDomainCallback (internal/process/next_tick.js:219:9)
这是我的代码,尽管我不太确定当URL转到成功/重定向URL时如何调用它:
exports.stripeCreateOathResponseToken = functions.https.onRequest((req, res) => { // res.send("code: " + req.query.code); // doesnt work here // res.send("state: " + req.query.state); // doesnt work here return stripe.oauth.token({ grant_type: 'authorization_code', // code: req.query.code, // doesnt work for some reason code: "<code given in url hardcoded>", // first shows as "authorization code does not belong to you" then shows "code has expired" after trying again a few minutes later state: req.query.state, // not sure if this is working // }).then(function (res) { }).then(function (response) { // asynchronously called // return res.send("code: " + res.query.code) return response.stripe_user_id; // return response.stripe_user_id; // this doesnt work // return request.query.code; // this doesnt work }); });
我也尝试过这个,它给我一个
200
成功代码,但返回的值为undefined
exports.stripeCreateOathResponseToken = functions.https.onRequest(cores((req, res) => { const authCode = req.query.code; const stateCode = req.query.state; return res.send("code: " + req.query.code + " state: " + req.query.state); // return res.send("code: " + req.body.code + " state: " + req.body.state); // <-- doesnt work return res.send("\nauthCode: " + authCode + "\nstateCode: " + stateCode) }));
感谢您提供所有帮助/指导。
我正在尝试让Stripe Express Connect与我的Cloud Firebase功能一起使用。到目前为止,我已经可以设置我的Android应用程序来打开浏览器,并通过一些...
我将向我的同事寻求有关您问题的帮助,我们也在通过iOS在Firebase上使用/实现Stripe Connect的过程。也许我们可以互相帮助