使用 Paypal IPN 防止重复
是否有一种方法可以让 paypal api 检查重复的 ID 并在找到 ID 时返回“无效”?
例子: 如果用户将产品放入购物车,浏览一段时间,然后结账,Paypal 是否会返回 INVALID(在她实际登录 Paypal 付款之前),因为其他用户已购买该产品 (=相同的产品ID)同时?
当然,我可以自己进行此检查,但只有在用户登录 Paypal 并返回我的网站之后。
感谢您的帮助
is there possibly a way that the paypal api checks for duplicate IDs and return "invalid" on finding one?
Example:
If a user puts a product in her cart, browses on for a while, then checks out, can Paypal return INVALID (before she actually log into paypal to pay) because another user has bought this product (= same productID) meanwhile?
Of course I could do this check myself, but only after the user has logged into Paypal and returned to my site.
Thx for your Help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您正在寻找的表达是“库存管理”。不,PayPal 似乎不提供此功能。
粗略地说,传统的方法是允许 UserA 在一段时间内保留 Product#1 的实例 P。如果您的 Product#1 的库存只有数量=1,那么在这段时间内,Product#1 1 将显示已售完 - 例如,用户 B 无法将其实例放入购物车。
P 期过后,如果您没有收到 PayPal(通过 PDT 或 IPN)发出的用户 A 已完成购买的确认,则用户 A 的预订将过期,并且产品#1 可以再次出售。
I think the expression you are searching for is "inventory management". And no, PayPal does not seem to provide this.
Roughly speaking, the traditional approach to this is to allow UserA to reserve an instance of Product#1 for a certain period of time, P. If you only have quantity=1 of Product#1 in stock, then during this time, Product#1 would appear sold out - e.g. UserB could not put an instance of it in their cart.
After period P, if you have not received confirmation from PayPal (either via PDT or IPN) that UserA has completed their purchase, then UserA's reservation expires, and Product#1 is available for sale again.
这与 PayPal 无关;我假设每当买家将商品添加到您自己网站上的购物车时,您都不会与 PayPal API 进行交互。
除非您正在谈论 cmd=_cart(网站支付标准购物车)功能,在这种情况下;不,这本身不能作为功能使用。您可以为此使用“防止重复发票”功能,并在“发票”字段中传递产品 ID。
这将阻止针对特定“发票”(产品 ID)进行任何付款,确保您只能为每个唯一产品获得 1 个订单。
例如,
并在 PayPal 帐户中启用以下选项:
简介>网站付款偏好 >阻止意外付款
This has nothing to do with PayPal; I assume you're not interacting with PayPal API's whenever a buyer adds something to the cart on your own site.
Unless you're talking about the cmd=_cart (Website Payments Standard cart) functionality, in which case; no, this is not available as a featuer per se. You could use the 'prevent duplicate invoice' functionality for this and pass the product ID in in the 'invoice' field.
This would prevent any payments to go through for a specific 'invoice' (product ID), ensuring you can only get 1 order per unique product.
E.g.,
And turn on the following option in the PayPal account:
Profile > Website Payment Preferences > Block accidental payments