douglasrcjames
douglasrcjames

Reputation: 1645

Error: Received unknown parameter: business_type - Node Stripe Connect

So I am trying to create a Stripe Connect account using a Firestore trigger function (onUpdate), but I keep getting the error: Error: Received unknown parameter: business_type in my Firebase Function logs. This makes me feel like I have poorly formatted the stripe.accounts.create() call. I followed the Stripe docs here. I got it working if I just include the values type, country, and email, but would like to include all important values right off the bat, but maybe I have to update other values after the account is created by stripe? If so is there a way to update these more values in the function(error, account) call below? Not a whole lot of example code I can find for this, so if anyone has worked with this and has some tips that would be great!

Snippet:

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 });
  }
});

Upvotes: 2

Views: 3391

Answers (1)

douglasrcjames
douglasrcjames

Reputation: 1645

As @duck and @Sebe suggested, I went to the Stripe dashboard to upgrade the API version and it fixed that error! (See stripe.com/docs/upgrades) Seems Stripe recently changed/updated the values expected for the stripe.accounts.create() function, which was why the value mismatched the docs.

Upvotes: 4

Related Questions