Hans Meier
Hans Meier

Reputation: 1

Preventing duplicates with Paypal IPN

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

Upvotes: 0

Views: 551

Answers (2)

Robert
Robert

Reputation: 19356

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

Upvotes: 0

cailinanne
cailinanne

Reputation: 8372

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.

Upvotes: 2

Related Questions