【发布时间】:2022-08-19 21:21:12
【问题描述】:
因此,我试图将我的 react-native 应用程序从条带结帐页面重定向回应用程序。
app.post(\'/create-checkout-session\', async (req, res) => {
const prices = await stripe.prices.list({
lookup_keys: [req.body.lookup_key],
expand: [\'data.product\'],
});
const session = await stripe.checkout.sessions.create({
billing_address_collection: \'auto\',
line_items: [
{
price: prices.data[0].id,
// For metered billing, do not pass quantity
quantity: 1,
},
],
mode: \'subscription\',
success_url: `${YOUR_DOMAIN}/?success=true&session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${YOUR_DOMAIN}?canceled=true`,
});
res.redirect(303, session.url);
});
使用成功 URL,但它不会重定向回应用程序。 我目前在 App.js 文件中使用 React Navigation、Deep Linking。
const linking = {
prefixes: [ Linking.createURL(\"hometrack://\")],
config:{
screens:{
EmployeeSignUp:{
path:\"EmployeeSignUp/:id\",
parse: {
id: (id) => `${id}`,
},
},
Success:{
path:\"Success\"
}
}
}
};
我似乎无法将其链接回应用程序。
-
这比 React 更像是一个 Stripe 问题!您使用的是哪个版本的 API?您是否在仪表板中验证了您的域以接收重定向?
-
@cuuupid 我相信是这样,当我放置一个本地主机 URL 但不是在反应导航中使用深层链接时它可以工作。
-
您是否尝试使用深层链接/自定义 URL 方案重定向到应用程序?如果是这样,您的深层链接是否正常工作,即如果您要去
hometrack://...some url...? -
@cuuupid 当我使用这个命令时
npx uri-scheme open \"exp://127.0.0.1:19000/--/hometrack://EmployeeSignUp/6264385f19b66c695f651a63\" --ios它打开到我正在寻找的页面。 -
为什么不使用 Stripe React Native SDK?
标签: javascript react-native stripe-payments react-navigation