G'day all
PREMISE:
I created a special store that has the PayPal option for payment. In general, the PayPal option works as follows:
- The user adds items to the shopping cart (if they are in stock)
- User selects delivery destination
- Click Check Now
- The user registers or enters delivery / payment data.
- The user is provided with a payment page to enter card details or click the "Pay with PayPal" button.
The Pay with PayPal button is what I want to adapt. I currently have a php function that takes all the items from the users basket and converts them into a PayPal form, which is then displayed on the page. This form contains all PayPal information, including items, quantities, sizes, shipping costs, business data, return / cancel / IPN URLs, etc.
PROBLEM:
If the user fills out his shopping basket on a specific day and goes through the verification procedure to the payment page, the PayPal form is just generated there (including the prices and quantities of goods that are currently in order)
They leave their computer without , by clicking the "Pay with PayPal" button, perhaps for a few days to think about it. At the same time, prices / stocks change for goods in their basket.
Even if I installed the incomplete carts for removal, say, after 24 hours, the user already has a PayPal form, so you can still click “Pay with PayPal” even a few months later, using the old inventory levels and prices!
DECISION:
I see several options here and open suggestions for each (or even a better solution!)
Install the “Payments” and “Cart” pages using the terrible “Refresh” meta tag so that they are updated every day and check php promotions / price before the page loads. Thus, if stocks or prices have changed, the user will be presented with the latest prices. (This is not my preferred option)
Instead of creating a PayPal form on the "Payment" page, click the "Pay with PayPal" button to send the user to another php page (for example, "process_paypal.php"), which performs all the necessary checks, and if there are any problems, A message can be sent to the user. (So far, so good). Then (and this is the part I'm struggling with), if everything is ok, generate a form and automatically submit it by redirecting the user to the PayPal website to log in (I know that this can be done quite easily using jQuery or Javascript, but if possible, I would prefer a PHP solution if such a thing exists? I'm not very familiar with cURL, so I don’t know, is used for)
You're telling me?!:)
Appreciate any help you can give on this.
Ben Avery
source share