【发布时间】:2021-06-24 03:25:29
【问题描述】:
我正在尝试使用以下逻辑为未经身份验证的客户实施结帐程序:
-
收集客户电子邮件
-
使用以下逻辑生成 Stripe 客户:
const customer = await stripe.customers .create({ email, name, }) .then((customer) => customer) .catch((error) => { console.log(error); return null; }); -
创建令牌以将帐户传递给我的 Stripe Connect 业务合作伙伴帐户。
const tempCustomerToken = await stripe.tokens.create( { customer: customerAccId, }, { stripeAccount: vendorStripeAcc, } ); -
根据业务伙伴的账户创建客户。
const tempCustomer = await stripe.customers.create( { source: tempCustomerToken.id, }, { stripeAccount: vendorStripeAcc, } ); -
使用业务合作伙伴账户中的客户 ID 创建结帐会话。
const session = await stripe.checkout.sessions.create( { payment_method_types: ['card', 'alipay'], customer: tempCustomer.id, line_items: items, success_url: 'https://example.com/success', cancel_url: 'https://example.com/cancel', payment_intent_data: { application_fee_amount: 50 }, }, { stripeAccount: vendorStripeAcc, } );
第 2 步失败并出现此错误 - The customer must have an active payment source attached.
但是,我希望客户在 Stripe Checkout 会话期间提供他们的付款方式,因此当我创建客户时,我不想向他们询问任何付款信息。
有没有办法实现以下目标:
- 在我的 Stripe 账户上使用电子邮件和无付款方式创建 Stripe 客户。
- 将此客户分享给
Stripe Connect业务合作伙伴。 - 允许客户使用
Stripe Checkout会话在Stripe Connect业务供应商帐户上进行direct购买。
【问题讨论】:
标签: javascript node.js stripe-payments