I would like to implement a robust way to handle ecommerce payment for items with limited quantity, like for example exclusive paintings. Payment would ideally be accepted via PayPal and credit cards. Ideally, it would work on a ‘first-come-first-serve’ basis, and wouldn’t just lock items out if you add them to cart like some online fashion stores do.
However, the main problem is that once you redirect the user to the payment solution, you do not have control over the user.
Even if I was to implement some form of locking on items, i.e a user adds it to cart and it is temporarily locked for other users for say 30 minutes – I think this problem would still prevail given the below workflow:
- User A adds item A with limited quantity (1) to cart. Item is removed from website for 30 minutes
- User A goes to payment on PayPal.
- For some reason, UserA does not pay immediately on PayPal but keeps session alive for say 1 hour
- After 30 minutes, website will restore item A back in stock
- User B adds to cart
- User B proceeds to payment
- User B pays for item
- User A, with the continuously refreshed session, pays for item as well.
This would result in double-purchase for the same item.
Is it possible to solve this problem 100%? I highly doubt this would happen in real-life, but would like to handle all possible cases.
2
Usually payment methods involve a step where your application will have to accept the payment. With PayPal it is after the customer is redirected back to your shop. Other PSPs (Payment Service Providers) will have some kind of notification, which you can accept or decline.
At this point you could fulfill the order or decline the fulfillment and the payment.
When choosing a PSP make sure to study the API docs and see if they provide this extra confirmation step.
It would still be not optimal from a customer experience standpoint. But if this is the business model, you would have to communicate very clearly the reasons why orders might not be accepted.
2