javascript - 不重定向到条带结帐页面 node.js
问题描述
我有这个功能:
app.post('/create-checkout-session', async (req, res) => {
const priceId = req.body.PRICE_ID;
console.log(priceId)
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
payment_method_types: ['card'],
line_items: [
{
price: priceId,
// For metered billing, do not pass quantity
quantity: 1,
},
],
// {CHECKOUT_SESSION_ID} is a string literal; do not change it!
// the actual Session ID is returned in the query parameter when your customer
// is redirected to the success page.
success_url: 'http://localhost:6166/?session_id={CHECKOUT_SESSION_ID}',
cancel_url: 'http://localhost:6166/test',
});
// Redirect to the URL returned on the Checkout Session.
// With express, you can redirect with:
// res.redirect(303, session.url);
})
当我登录时priceId
,它会记录它,所以我知道我的前端正在使用该功能,但是,它只是挂起,它不会重定向,也不会给我任何控制台错误。任何想法我做错了什么?
解决方案
推荐阅读
- flutter - Flutter:不推荐使用 BitmapDescriptor.fromAsset
- sql - 何时使用 NoLock 和 ReadPast?使用 nolock 和 ReadPast 都面临问题
- javascript - this.setState() is changing state to wrong value
- spring-boot - 带有 Spring Boot CORS 的 App Engine Standard 无法正常工作
- css - "Unexpected character '" when importing theme
- sql - 在查询窗口中突出显示并运行忽略联合
- javascript - Chrome extension problem with change textarea content
- django - 重定向()没有指向正确的视图
- php - 如何使用递归 PCRE 正则表达式匹配嵌套 css?
- r - 找不到函数“%like%”