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 });
}
});
@types/stripe
type definitions are not updated. You could trynpm i @types/stripe
maybe they have added the missing types. Or you have to modify the type definition yourself. Had this problem with the Payment Intent API recently. – Sebastian Vischer