ตอนที่ฉันคลิกที่ปุ่มบน frontend ฉันเข้าใจบอกให้ localhost/สร้าง-บัญชี-เป็นเจ้าภาพแต่ renders"ไม่สามารถโพสต์". บุรุษไปรษณีย์ย่างไรก็ตามแสดง Endpoint ทำงานแค่สบายดี
ไม่แน่ใจว่าชั้นมีอะไรผิดปกติที่นี่
ปรับแต่งโปรแกรมเบื้องหลั endpoint บ Firebase ฟังก์ชันที่โฟลเดอร์
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)
หน้าจอรหัสโพสรูปแบบการร้องขอสำหรับเซิร์ฟเวอร์ด้านข้าง redirecting.
<div className="beASeller">
<form
type="submit"
action="/create-account-hosted"
method="POST"
class="stripe-connect white"
>
<button> Seller Signup</button>
</form>
</div>