stripe-payments - Stripe Connect 从服务器创建帐户
问题描述
我正在尝试在用户注册时使用我的 Firebase 功能后端创建一个条带连接帐户,但不断收到此错误Express accounts may only be created via the OAuth flow
我知道该错误似乎不言自明,我需要使用标准 OAuth 注册方法,但在文档中它指出API 可以创建自定义类型,并为每个只想发送资金而不接收资金的用户呈现 OAuth,这很烦人,我是否为 API 做错了而不是创建它?或者是否有一种解决方法不必为只想发送资金的用户显示 OAuth?
exports.createStripeCustomer = functions.auth.user().onCreate(async (user) => {
const customer = await stripe.customers.create({email: user.email});
const account = await stripe.accounts.create({type: 'custom', business_type: 'individual', individual: {email: user.email}, requested_capabilities: ['card_payments', 'transfers'], email: user.email});
return admin.firestore().collection('stripe_customers').doc(user.uid).set({account_id: account.id, customer_id: customer.id});
});
解决方案
使用 Connect 时, Express Accounts 和 Custom Accounts 是不同类型的帐户。您可以使用 API创建自定义帐户,但必须通过 OAuth 创建快速帐户。
主要区别在于 Express Accounts 可以访问 Stripe Dashboard,并且可以由最终用户以某种方式进行更新,而 Custom Accounts 则完全由平台管理。
推荐阅读
- angularjs - AngularJS:仅在某些数据存在时添加 ng-show 属性
- spring - Spring Feign Client JSON解析错误:非法字符
- git - Git引发简单合并的冲突
- java - 发送没有关键值的改造获取请求
- javascript - 为动态创建的输入标签分配和更新值 - jquery
- .net-core - 使用 Magick.Net 生成的 Pdf 文件的 png 是黑色的 #695
- rust - 如果我在代码的不同位置使用非可变变量,为什么会出现借用错误?
- c++ - 为什么 Visual Studio C++ 2019 说找不到 SDK 版本当我拥有它时
- kotlin - 如何更改 Korge NinePatch 的宽度和高度?
- flatbuffers - Flatbuffers:不同的字段名称但相同的偏移量