[英]Paypal: empty cart session soon after the form submit button is clicked
How can I delete the cart session soon after the submit button is clicked to send the form data to paypal? 单击提交按钮以将表单数据发送到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? 似乎只能在javascript的ajax中完成? What about just http or php?
那么http或php呢?
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 但是,如果您要删除所有内容,则需要将表单过帐到网站上的页面,然后将数据重新过帐到PayPal
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.