I'm running into a weird problem. It's very intermittent. It's almost related to iPhone and Safari. And, to this day, I'm unable to replicate it. Probably happens a couple of transactions per month.
The issue is when the customer is clicking the PayPal button option to pay via PayPal. This is using the IPN form post to post the cart and transaction information to PayPal. A new window is opened, and they are presented with PayPal's page.. as if they just typed the URL. No information about the order, etc.
As I mentioned, this is very inconsistent and intermittent. 99% of the users are presented with the transaction total and they can check out, etc. If I'm emailed with this problem, I ask that they try a different browser, chrome, etc.. and it typically works. It seems like it's generally iPhone and Safari browser. Sometimes with old phones. Sometimes with new phones, etc.
This is not related to the post back info on the transaction from PayPal, but the posting of cart information to PayPal.
Here is my HTML/PHP code with this info.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<?
$count = 1;
$session->setValue('sInvoice', strtoupper(substr(md5(uniqid(rand(),1)),0,8)));
for($val = 0; $val < sizeof($Cart); $val++){
$productID = $Cart[$val]['ProductID'];
$productTitle = $Cart[$val]['ProductLineDescription'];
$productPrice = $Cart[$val]['UnitPrice'];
$quantity = $Cart[$val]['Quantity'];
$calcPrice = $Cart[$val]['LineItemPrice'];
$shipping = number_format($session->getValue("ShippingTotal"), 2, '.', ',');
?>
<input type="hidden" name="item_name_<?=$count?>" value="<?=specialchars($productTitle)?>" />
<input type="hidden" name="amount_<?=$count?>" value='<?=number_format($productPrice, 2, '.', ',')?>' />
<input type="hidden" name="quantity_<?=$count?>" value="<?=$quantity?>" />
<input type='hidden' name='item_number_<?=$count?>' value='' />
<?
$count++;
}
?>
<input type="hidden" name="shipping_1" value='<?=$shipping?>' />
<input type="hidden" name="no_shipping" value="2" />
<input type="image" id="PayPalButton" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" name="submit" class="wp_cart_checkout_button" alt="Make payments with PayPal - it's fast, free and secure!" />
<input type="hidden" name="return" value="https://www.example.com/thankyou/" />
<input type="hidden" name="notify_url" value="https://www.example.com/paypal/" />
<input type="hidden" name="business" value="[email protected]" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="mrb" value="3FWGC6LFTMTUG" />
<input type="hidden" name="custom" value="cid=<?=$xCartID?>" />
</form>
When a user has a problem, I've noted the items and attributes in their cart, and try on my end, but never able to replicate the problem. Clicking the PayPal button behaves as expected.
Any ideas? TIA
I can tell you what I would do, which is switch to a current integration method that does not rely on outdated HTML form posts. Here's the client-side-only one: https://developer.paypal.com/demo/checkout/#/pattern/client
The v2/checkout/orders purchase_unit request object is documented here
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
https://www.w3.org/html/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.