type Stripe = {
token: string;
};
/**
* Post accounts account bank accounts id
* Updates the metadata, account holder name, account holder type of a bank account belonging to a Custom account, and optionally sets it as the default for its currency. Other bank account details are not editable by design.
You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.
*/
export async function main(
auth: Stripe,
account: string,
id: string,
body: {
account_holder_name?: string;
account_holder_type?: "" | "company" | "individual";
account_type?: "checking" | "futsu" | "savings" | "toza";
address_city?: string;
address_country?: string;
address_line1?: string;
address_line2?: string;
address_state?: string;
address_zip?: string;
default_for_currency?: boolean;
documents?: {
bank_account_ownership_verification?: {
files?: string[];
[k: string]: unknown;
};
[k: string]: unknown;
};
exp_month?: string;
exp_year?: string;
expand?: string[];
metadata?: { [k: string]: string } | "";
name?: string;
}
) {
const url = new URL(
`https://api.stripe.com/v1/accounts/${account}/bank_accounts/${id}`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 368 days ago
type Stripe = {
token: string;
};
/**
* Post accounts account bank accounts id
* Updates the metadata, account holder name, account holder type of a bank account belonging to a Custom account, and optionally sets it as the default for its currency. Other bank account details are not editable by design.
You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.
*/
export async function main(
auth: Stripe,
account: string,
id: string,
body: {
account_holder_name?: string;
account_holder_type?: "" | "company" | "individual";
account_type?: "checking" | "futsu" | "savings" | "toza";
address_city?: string;
address_country?: string;
address_line1?: string;
address_line2?: string;
address_state?: string;
address_zip?: string;
default_for_currency?: boolean;
documents?: {
bank_account_ownership_verification?: {
files?: string[];
[k: string]: unknown;
};
[k: string]: unknown;
};
exp_month?: string;
exp_year?: string;
expand?: string[];
metadata?: { [k: string]: string } | "";
name?: string;
}
) {
const url = new URL(
`https://api.stripe.com/v1/accounts/${account}/bank_accounts/${id}`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 795 days ago
type Stripe = {
token: string;
};
/**
* Post accounts account bank accounts id
* <p>Updates the metadata, account holder name, account holder type of a bank account belonging to a <a href="/docs/connect/custom-accounts">Custom account</a>, and optionally sets it as the default for its currency. Other bank account details are not editable by design.</p>
<p>You can re-enable a disabled bank account by performing an update call without providing any arguments or changes.</p>
*/
export async function main(
auth: Stripe,
account: string,
id: string,
body: {
account_holder_name?: string;
account_holder_type?: "" | "company" | "individual";
account_type?: "checking" | "futsu" | "savings" | "toza";
address_city?: string;
address_country?: string;
address_line1?: string;
address_line2?: string;
address_state?: string;
address_zip?: string;
default_for_currency?: boolean;
documents?: {
bank_account_ownership_verification?: {
files?: string[];
[k: string]: unknown;
};
[k: string]: unknown;
};
exp_month?: string;
exp_year?: string;
expand?: string[];
metadata?: { [k: string]: string } | "";
name?: string;
}
) {
const url = new URL(
`https://api.stripe.com/v1/accounts/${account}/bank_accounts/${id}`
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer " + auth.token,
},
body: encodeParams(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
function encodeParams(o: any) {
function iter(o: any, path: string) {
if (Array.isArray(o)) {
o.forEach(function (a) {
iter(a, path + "[]");
});
return;
}
if (o !== null && typeof o === "object") {
Object.keys(o).forEach(function (k) {
iter(o[k], path + "[" + k + "]");
});
return;
}
data.push(path + "=" + o);
}
const data: string[] = [];
Object.keys(o).forEach(function (k) {
if (o[k] !== undefined) {
iter(o[k], k);
}
});
return new URLSearchParams(data.join("&"));
}
Submitted by hugo697 922 days ago