Paypal:单击表单提交按钮后很快就会出现空购物车会话

发布于 2024-12-18 16:33:32 字数 464 浏览 3 评论 0原文

单击提交按钮将表单数据发送到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

汐鸠 2024-12-25 16:33:32

如果我是你,我会在交易完成后重新定向到你的网站时清空购物车 - 这样,如果交易中止(例如,用户想要删除/添加某些内容),他们可以轻松完成!

但是,如果您想删除所有内容 - 那么您需要将表单发布到您网站上的页面,然后将数据重新发布到 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文