【发布时间】:2019-06-08 12:05:51
【问题描述】:
正在尝试将 post 表单请求发送到另一台服务器。
我收到来自本地主机的 post 请求,可以在 POST /deposit 上说
我想稍后用某种数据将用户重定向到支付网站
发帖后我希望用户重定向到的表单:localhost:3000/deposit
<form action='http://testpayment.com/pay' class='redirect_form' method='post'>
<input type='hidden' name='key' value='${data.api_id}'>
<input type='hidden' name='signature' value='${data.api_secret_key}'>
<input type="hidden" name='user_id' value='${data.user_id}'>
<input type="hidden" name="payment_method" value="master_card">
<input type="hidden" name="customproduct" value='[{
"productId":"deposit-${currencyPayway.currency.code}",
"productName":"Test Product",
"productType":"fixedProduct",
"currency":"${currencyPayway.currency.code}",
"amount":${amount}}]'>
<button type='submit'>Pay</button>
</form>
发布路线:
app.post('/deposit', function(req, res) {
// some logic applies here
//redirect part ???
});
任何想法如何做到这一点? 谢谢。
更新: 我要做的用例: 假设我们有多个支付提供商。在应用一些逻辑后以任何方式进行存款操作时,我们需要将用户重定向到支付提供商网站以输入卡/帐户详细信息,之后支付提供商将再次将用户重定向回我的网站。现在 front 每次都为所有存款方式编写自定义逻辑。但我试图将前端与那些东西分离,并在后端完全处理它并统一存款流程。
【问题讨论】: