export const get_static_account_number = async ({
amount,
tx_ref,
email,
meta,
is_permanent,
bvn,
}: {
amount: number;
tx_ref: string;
email: string;
meta: static_account_meta | null;
is_permanent?: boolean;
bvn?: string;
}) => {
let accountDetails: null | static_account_props = null;
const payload = {
email: email,
currency: "NGN",
is_permanent: is_permanent,
bvn: bvn,
tx_ref: tx_ref,
amount: amount,
meta: meta,
};
const res = await fetch(
`https://api.flutterwave.com/v3/charges?type=bank_transfer`,
{
method: "POST",
headers: {
Authorization: String(process.env.FLW_SECRET_KEY),
},
body: JSON.stringify(payload),
}
);
if (!res.ok) {
accountDetails = null;
return;
}
const data = await res.json();
accountDetails = data;
return accountDetails;
};
use json data instead of form data