douji2283 2016-08-24 12:17
浏览 87
已采纳

转到-使用有效负载重定向到特定的URL

I'm currently trying to implements payment method of my client onto my application. To show the payment page, I need to perform request to their url with body information about the payment. The response is html of the payment page. Then I print the html to the view.

But whenever I clicked pay button on the generated view, error occured say that session is invalid, it's because even the payment page is showing up it's still on our host (cross domain problem). I need to click the pay button from their host, it's mean that my application need to be redirected to their host.

Can we redirect to another url but attach body on the header of the request?

I want to redirect to this url "http://payment.api.net/merchant/init?corpid=CN000001", but including this body request.

<order>
 <corp>NN01</corp>
 <amount>20.0</amount>
 <currency>USD</currency>
 <ordernumber>10010111</ordernumber>
 <redirect>http://mycallback.api.net/store/payment/callback</redirect>
 <randomstring>NnwLRINzhOgvmvyunzZIrUtCgvmvy</randomstring>
 <hash>4792e72f5e1860b220420ad3f22f005c9d2fce83f3a138336869780153145700</hash>
</order>

How to achieve this?

UPDATE

It's impossible

SOLUTION

See ainur answer, I don't understand why, but it's working like a charm

  • 写回答

1条回答 默认 最新

  • dongzhuang6247 2016-08-25 04:41
    关注

    Try to use this code..

    <html>
        <body>
        <form action="http://payment.api.net/merchant/init?corpid=CN000001" method="post" enctype='text/plain'>
            <input type="hidden" name="order" value='<order><corp>NN01</corp><amount>20.0</amount><currency>USD</currency><ordernumber>10010111</ordernumber><redirect>http://mycallback.api.net/store/payment/callback</redirect><randomstring>NnwLRINzhOgvmvyunzZIrUtCgvmvy</randomstring><hash>4792e72f5e1860b220420ad3f22f005c9d2fce83f3a138336869780153145700</hash></order>'>
            <button type="submit">Submit</button>
        </form>
        </body>
    </html>

    May it solve your problem..

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?