Stripe Connect Express 帐户 refreshURL 和 returnURL 未定义

Stripe Connect Express account refreshURL and returnURL are undefined

我正在使用 Stripe Connect Express(新手,紧随其后 STRIPE API DOCS)。我目前正在尝试在成功创建 Stripe Express 帐户后创建 AccountLink。

但是,我无法创建 AccountLink,因为我在创建 AccountLink 时遇到错误,因为 account.refresh_urlaccount.return_url 似乎是 undefined

exports.onCreateAuthUser = functions.auth.user().onCreate(async (user) => {
    // Set your secret key. Remember to switch to your live secret key in production.
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    const strip = require('stripe')('sk_test_key_input_here');

    const account = await strip.accounts.create({
      type: 'express',
    });

    let refURL = account.refresh_url
    let retURL = account.return_url

    console.log("account log stuff -->", account, retURL, refURL, account.uid, account.userId, account.userRef, account.user, account.id, account.ref, account.pushId, account.customer_id)

    const accountLinks = await stripe.accountLinks.create({
       account: account.id,
       refresh_url: refURL,
       return_url: retURL,
       type: 'account_onboarding',
     });

 });

console.log 打印:

account log stuff --> undefined undefined undefined undefined undefined acct_1IbJSgPMwPhmaSsD undefined undefined undefined 

有谁知道为什么这些属性未定义...以及我如何解决它或出了什么问题?

return 和刷新 URL 不是 Stripe 生成的 URL,它们是您提供给 Stripe 的 URL,因此它们可以将您的用户重定向到您的网站。

return_url 是 Stripe 将在您的用户完成入职流程后重定向的地方。

至于refresh_url

The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link’s URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.

https://stripe.com/docs/api/account_links/create#create_account_link-refresh_url