I tried to make a Paypal checkout like here. That works fine for Chrome but in Firefox I get stuck with this:
Form
<html><body>
Paypal redirect...<br />
<form name="frm" action="https://sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="bbbb#bbb.com" />
<input type="hidden" name="return" value="http://bbb.com/yeah.php" />
<input type="hidden" name="undefined_quantity" value="1" />
<input type="hidden" name="item_name" value="Order #<?= $_SESSION['order_id'] ?>" />
<input type="hidden" name="item_number" value="order_<?= $_SESSION['order_id'] ?>" />
<input type="hidden" name="amount" value="<?= $_SESSION['kasse_price'] ?>" />
<input type="hidden" name="shipping" value="0.00" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="cn" value="Comments" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="lc" value="DE" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input type="image" src="https://www.paypal.com/de_DE/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="Mit PayPal bezahlen." />
<img alt="" border="0" src="https://www.paypal.com/de_DE/i/scr/pixel.gif" width="1" height="1" />
</form>
<script language="JavaScript">
document.frm.submit();
</script></body></html>
I checked the POST parameters send to Paypal. The look fine for both browsers. Notice that I automatically send the form. I know that is not nice but I don't know a better way to I try to make this work.
Any idea why it fails for Firefox?
It's not about Firefox or Chrome, you need to be logged in with your developer account. You should have a developer account (set up here https://developer.paypal.com/) you used to define at least a buyer and a seller account.
To use the sandbox account you need to be logged in. You will have a "pseudo-login" for that buyer account you have but that's in the context you are already logged in with your dev account.
Related
I'm having a weird problem that is very intermittent. In fact, I've never been able to reproduce it on my end, but a variety of customers have experienced it. Typically, it's with mobile IOS - new and old. Basically, when the customer reaches checkout, they click Check Out and they end up on PayPal's login page. No values from the form are passed, as if they just went to PayPal.com. We do get a lot of sales via PayPal, so not sure what percentage has this issues, but want to make sure we capture those sales. Doing a Google, I have seen people mention this, but not seeing any solid solutions.
Here is my form code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="item_name_1" value="Product Test 1" />
<input type="hidden" name="amount_1" value='10.00' />
<input type="hidden" name="quantity_1" value="1" />
<input type='hidden' name='item_number_1' value='' />
<input type="hidden" name="shipping_1" value='8.00' />
<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/?a=1" />
<input type="hidden" name="notify_url" value="https://www.example.com/paypal/" />
<input type="hidden" name="business" value="paypal#example.com" />
<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="cart=58597ef8bdd56c789946533a9c1d0d1c&x=337917&email=test#example.com&ip=6xxx.xxx.xxx.xxx" />
</form>
I've seen people remove target="paypal" and use target="_self". I've only used target="_blank". I don't want to use GET method since I could have lot of variables depending on how large the cart is. Every time I test (desktop, table, phone), the paypal process works. So not sure what is stopping some of the users.
I was working with paypal recurring payment subscription form and using sandbox account for testing
here is my form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="testacc#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Standard Pack">
<input type="hidden" id="item_number" name="item_number" value="1233434-23213">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="user_id" value="13692">
<input type="hidden" id="package_id" name="package_id" value="<?php echo $package_type; ?>">
<input type="hidden" name="a1" value="0">
<input type="hidden" name="p1" value="1">
<input type="hidden" id="t1" name="t1" value="M">
<input type="hidden" id="a3" name="a3" value="10">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input name="return" type="hidden" value="<?php echo base_url();?>package/new_payment_success" />
<input name="notify_url" type="hidden" value="<?php echo base_url();?>package/new_payment_notify" />
<input name="cancel_return" type="hidden" value="<?php echo base_url();?>package/new_payment_cancel" />
<div class="paypal-btn">
<input type="image" src="pay-with-paypal.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style='width: 125px'>
</div>
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
and it's working totally fine and sends a success information to notify_url url
now for security purpose im checking HTTP_USER_AGENT from $_SERVER variable but this can be modified too.
so how can i make sure that transection is done successfully before i update my database?
I think that you can verify the whole POST content by appending cmd=_notify-validate and sending it to PayPal. They will answer you with a Verified or Not verified response.
Please, check the link below for more information:
https://developer.paypal.com/docs/classic/ipn/gs_IPN/
my php code generates html form which is submitting automatically with redirection of customers:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" name="vm_paypal_form" id="vmPaymentForm" accept-charset="UTF-8">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<input type="hidden" name="business" value="bolpav#example.com" />
<input type="hidden" name="custom" value="otmjboutim6sl98u6olis61nm7" /
><input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=3L99030&pm=1&Itemid=166&lang=" />
<input type="hidden" name="notify_url" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang=" />
<input type="hidden" name="cancel_return" value="http://example.com/devportal/index.php?option=com_virtuemart&view=vmplg&task=pluginUserPaymentCancel&on=3L99030&pm=1&Itemid=166&lang=" />
<input type="hidden" name="rm" value="1" />
<input type="hidden" name="bn" value="VirtueMart_Cart_PPA" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="image_url" value="http://example.com/devportal/images/virtuemart/vendor/" />
<input type="hidden" name="item_name" value="Order Number: 3L99030" />
<input type="hidden" name="lc" value="EN" />
<input type="hidden" name="a3" value="105" />
<input type="hidden" name="p3" value="1" />
<input type="hidden" name="t3" value="M" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="srt" value="52" />
<input type="hidden" name="sra" value="1" />
<input type="submit" value="Please wait while redirecting to PayPal" />
</form>
After this form is submited i see page with order number, price and message : ". To complete your checkout using PayPal, please log in." After i click Login button then it redirects me to login page . But after i login then it open dasboard and forgets about payment . So payment procedure gets broken. I am using Sanbox business account for seller and sandbox personal account for customer. Can anybody help?
It seems to be a known issue at PayPal's end. The engineering team is working on this for a fix. Will update here once it gets fixed.
.I am developing a site where users can login with paypal and pay for a specific service. Money is transferring correctly. But i always get the status as Pending and reason as paymentreview or reason as unilateral. Is there any way to get the status when it is completed. I am testing this in sandbox. my code is
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST" name="_cart" id="paypal_form">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="mybusiness#gmail.com" />
<input type="hidden" id="custom" name="custom" value=""/>
<input type="hidden" id="on0" name="on0" value="0"/>
<input type="hidden" id="amount_1" name="amount_1" value="10" />
<input type="hidden" name="currency_code" value="<?php echo $cntry; ?>" />
<input type="hidden" name="item_name" value="Account Deposit" />
<input type="hidden" id="amount" name="amount" value="10" />
<input type="hidden" name="return" value="RETURN URL AFTER TRANSACTION" />
<input type="hidden" name="notify_url" value="URL FOR UPDATING STATUS AFTER PAYMENT" />
<input type="hidden" name="cancel_return" value="MYSITE.COM" />
</form>
Thank you..
That's what IPN is for. You get a notice sent to you by Paypal that will notify you when you get paid or when your payment status changes. So Paypal will notify you when your payment status goes to Completed
I have a displaycart.php page where it displays all items I have in a shopping cart, each item has an ItemUnitPrice field where it shows the unit price of the item.
If I have say 6 items in the cart then I want to add up the total ItemUnitPrice fields and set that amount to be paid with PayPal.
I have checked out PayPals button features which they allow and you can only set a given price for the user to pay for when you create the button.
Is there a way I can link the PayPal button to my database so it shows the total of all the ItemUnitPrice fields.
The variable which holds the total ItemUnitPrice:
<?php
$Total = $Quantity * $ItemUnitPrice;
?>
The PayPal 'Pay Now' Button:
<html>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="KAMQ5PVWVDYYN">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</html>
Edit:
Yeah I've done something stupidly wrong!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="info#asianweddingservices.org" />
<input type="hidden" name="item_name" value="<? $ItemDesc ?>" />
<input type="hidden" name="item_number" value="<?$ItemCode ?>" />
<input type="hidden" name="amount" value="<?$Total ?>" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input src="paypal/purchase.png" name="Submit" type="image" value="purchase" alt="Purchase" />
</form>
Yes. Change the set value to your total.
Show your code and I can edit the answer to fix it for you.
Add this:
<input type="hidden" name="amount" value="<? echo $Total; ?>" />
If that doesn't work:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="PAYPAL EMAIL" />
<input type="hidden" name="item_name" value="ITEM NAME" />
<input type="hidden" name="custom" value="CUSTOM VALUE" />
<input type="hidden" name="item_number" value="ITEM NUMBER" />
<input type="hidden" name="amount" value="TOTAL" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input src="paypal/purchase.png" name="Submit" type="image" value="pruchase" alt="Purchase" />
</form>
Replacing the values to yours of-course.