首页 > 解决方案 > 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});
});

标签: stripe-payments

解决方案


使用 Connect 时, Express Accounts 和 Custom Accounts 是不同类型的帐户。您可以使用 API创建自定义帐户,但必须通过 OAuth 创建快速帐户。

主要区别在于 Express Accounts 可以访问 Stripe Dashboard,并且可以由最终用户以某种方式进行更新,而 Custom Accounts 则完全由平台管理。


推荐阅读