Paypal:单击表单提交按钮后很快就会出现空购物车会话
单击提交按钮将表单数据发送到 PayPal 后,如何立即删除购物车会话?
例如,
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name_1" value="Book 1" />
...
<button type="submit" name="submit">Check Out</button>
</form>
我需要运行这个脚本来清空购物车,
unset($_SESSION[SESSION_CART]);
unset($cart);
似乎只能在javascript的ajax中完成?如果只是 http 或 php 呢?
How can I delete the cart session soon after the submit button is clicked to send the form data to paypal?
For instance,
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="item_name_1" value="Book 1" />
...
<button type="submit" name="submit">Check Out</button>
</form>
And I need to run this script to empty the cart,
unset($_SESSION[SESSION_CART]);
unset($cart);
It seems that it only can be done in javascript's ajax? What about just http or php?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我是你,我会在交易完成后重新定向到你的网站时清空购物车 - 这样,如果交易中止(例如,用户想要删除/添加某些内容),他们可以轻松完成!
但是,如果您想删除所有内容 - 那么您需要将表单发布到您网站上的页面,然后将数据重新发布到 PayPal
If I were you, I'd empty the cart upon re-directing to your site after the transaction was completed - that way if it gets aborted (eg. the user wants to delete/add something) they can do with less fuss!
However, if you want to delete everything - then you need to POST the form to a page on your website, and then re-POST the data to PayPal