【问题标题】:Error: Received unknown parameter: business_type - Node Stripe Connect错误:收到未知参数:business_type - Node Stripe Connect
【发布时间】:2019-09-10 17:53:27
【问题描述】:

因此,我尝试使用 Firestore 触发功能 (onUpdate) 创建 Stripe Connect 帐户,但在我的 Firebase 功能日志中不断收到错误消息:Error: Received unknown parameter: business_type。 这让我觉得我的stripe.accounts.create() 调用格式不正确。我关注了Stripe docs here。如果我只包含值typecountryemail,我就可以正常工作,但我想立即包含所有重要值,但也许我必须在帐户创建后更新其他值条纹?如果是这样,有没有办法在下面的function(error, account) 调用中更新这些更多的值?我找不到很多示例代码,所以如果有人使用过这个并且有一些很棒的提示!

片段:

const response = await stripe.accounts.create({ 
  type: 'custom',
  country: 'US',
  // Optional Values
  requested_capabilities: ['platform_payments'],
  email: newValue.email,
  // tos_acceptance: newValue.stripeTosAcceptance,
  business_type: 'individual',
  individual: {
    //some other options values we could include (see docs)
    // address? Gender? default currency? verification docs?
    first_name: newValue.firstName,
    last_name: newValue.lastName,
    ssn_last_4: newValue.ssnLast4,
    dob: {
      day: newValue.dob.day,
      month: newValue.dob.month,
      year: newValue.dob.year
    }
  },
}, function(error, account) {
  if(error){
    console.log("Error: " + error);
  } else {
    console.log("Writing account.id to user DB...");
    admin
      .firestore()
      .collection("users")
      .doc(context.params.userId)
      .set({ connect_id: account.id }, { merge: true });
  }
});

【问题讨论】:

  • 这个错误什么时候发生?功能是部署还是部署期间?
  • 当函数部署到 firebase 时,但请注意,也许有比每次都部署到 firebase 更好的方法来测试我的函数?
  • 您的帐户使用的是什么版本的 Stripe API? Stripe 处理连接帐户的方式最近发生了重大变化。我建议将您的帐户升级到最新版本,我怀疑这会解决问题。 stripe.com/docs/upgrades#2019-02-19
  • 你使用打字稿吗?正如@duck 提到的,最近有一些变化,@types/stripe 类型定义没有更新。你可以试试npm i @types/stripe,也许他们已经添加了缺失的类型。或者您必须自己修改类型定义。最近付款意图 API 出现了这个问题。
  • 更新:我去我的 Stripe 仪表板升级 API 版本,它修复了这个错误!多谢你们! (见stripe.com/docs/upgrades

标签: node.js google-cloud-firestore stripe-payments


【解决方案1】:

正如@duck 和@Sebe 建议的那样,我去了 Stripe 仪表板升级 API 版本,它修复了这个错误! (请参阅 stripe.com/docs/upgrades)似乎 Stripe 最近更改/更新了 stripe.accounts.create() 函数的预期值,这就是该值与文档不匹配的原因。

【讨论】:

    猜你喜欢
    • 2019-03-16
    • 2019-09-20
    • 1970-01-01
    • 2017-08-15
    • 1970-01-01
    • 2019-10-19
    • 2015-03-13
    • 2019-11-02
    • 1970-01-01
    相关资源
    最近更新 更多