Work with two people buying a unique item in an online store at the same time

I am creating a simple online store with PHP integrated with PayPal that sells unique items. I wonder how other stores deal with several people trying to go through the payment process with the same item.

This is my current project strategy:

  • Elements have three types of status: available, paused, and sold.
  • When the user goes to the PayPal payment page, he checks the status of all the items in the basket to make sure that they are available. It also sets the itemโ€™s status to โ€œholdโ€ until it returns after confirming payment or time (10 minutes? Not sure what it should be).

Is this a standard practice or is there a more practical way that I should deal with?

Thanks in advance!

+6
php concurrency e-commerce paypal
source share
5 answers

I would say that the first part of your strategy is correct - when you go to the payment page, mark all products as โ€œon holdโ€

When the user completes the payment, you will receive a return transfer from Paypal, which will notify you whether the authorization was successful or not (and perhaps also allows you to check the result of CSC / CVV2), and at this point you have the opportunity to either accept the payment or reject his.

When you receive a postback, you should also check to see if all items are on hold. If they were calculated, you can reject the payment and display the message "sorry - timed out" or something similar.

This method also allows you to develop an ideal timeout period if you keep track of how often clients start the timeout, so you can extend the timeout (for example, from 5 to 10 minutes if too much time is turned off, or shorten it if none of which is not disabled.

0
source share

Check out the Dell UK outlet . When someone adds a system to their cart, it is held and inaccessible to other customers. If it is not purchased, the product will be removed from the basket after 15 minutes of inactivity and then available to other customers.

+2
source share

woot.com is known for this problem, but their solution works well. After confirming the payment information, the user is displayed on the page with a small amount of text, which says something like "your order is on, we check the inventory."

It looks like the PayPal API has a "RefundTransaction" message, so something like this may not be possible. But the user interface may be inconvenient if you go to the PayPal site and then return to your site.

0
source share

This is very similar to booking theater tickets or similar online, and yes, as you describe, it usually works. At some point, the element is โ€œreservedโ€ in the system, and either the client completes the transaction, or the element is released after some time for others to buy.

Of course, the moment you reserve the item (when it is added to the basket, the moment you send them for payment, etc.) is up to you. I would expect putting it in the basket would be a better choice, as it will reduce the likelihood that someone will create a basket of things, only to find half of them is no longer available at the box office.

0
source share

This is a fairly common problem with fixed inventory systems such as venue, transport / airline tix, etc.

I like the model of the airline, where as soon as you get the plant you need and choose, you get a page with passenger information with a message that the seats are being held, and now you have xx (10/15) minutes to complete the purchase, At that time, everything is becoming apparent. For another unique / only product, I think that the message on any page that the user clicks on, saying that you have xx (mins) left to complete the purchase, will be a great motivator for buyers "on the edge"

0
source share

All Articles