Quando clicco il Pulsante sul frontend, ho diretto a localhost/creare-account-hosted, ma rende "Impossibile inviare". Postino, invece, evidenzia l' Endpoint funziona bene.
Non so cosa ho sbagliato qui.
Backend endpoint Firebase Funzioni cartella
app.post("/create-account-hosted", async (req, res) => {
try {
var account = await stripe.accounts.create({
type: "custom",
requested_capabilities: ["card_payments", "transfers"],
business_type: 'company',
})
var accountLink = await stripe.accountLinks.create({
account: account.id,
success_url: "https://example.com",
failure_url: "https://example.com",
type: "custom_account_verification",
collect: "eventually_due",
});
} catch (err) {
console.log(err);
res.status(400);
res.send({ error: err });
return;
}
res.send(accountLink.url)
Anteriore codice di Fine modulo richiesta POST per il lato server di reindirizzamento.
<div className="beASeller">
<form
type="submit"
action="/create-account-hosted"
method="POST"
class="stripe-connect white"
>
<button> Seller Signup</button>
</form>
</div>