I am trying to do a mobile shopping cart and wish to make the process as simple as possible.
The client selects the products and I calculate the totals.
He clicks buy now and the total is sent to paypal express.
The product details are stored in our own database.
We need to only allow delivery to paypal account holder address and only verified accounts
I don't want the client to have to enter his delivery address (as it is stored at paypal).
So how can I ease the pain and get the customer details.
I am redirecting back to a page on the mobile when site when completed. Can I pass the data when this happens?
I am using a buy now button:
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" id="business" value="payment#xxxx.com">
<input type="hidden" name="currency_code" id="currency_code" value="USD">
<input type="hidden" name="item_name" id="item_name" value="Teddy Bear">
<input type="hidden" name="amount" id="amount" value="12.99">
<input name="return" type="hidden" value="http://xxxx.com?pageToJump=pagePayPalCompleted" /> <input name="cancel_return" type="hidden" value="http://xxxx.com?pageToJump=pagePayPalCancelled" />
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
MrWarby.
If you are using a Buy Now button this information is not passed back by default, you would need to enable PaymentDataTransfer: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/paymentdatatransfer/ or InstantPaymentNotification https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/
Related
Hi I have an issue where I have a PayPal form on my website when I click to pay using a Desktop web-browser, the transaction completes with all IPN Posted data from PayPal being correct! However when I use an android or IOS device the transaction completes, but there is no Posted data from PayPal when user clicks the return to business-name site? Now if I do another transaction with the Desktop web-browser using an android user-agent, I get the same results that is happening with the mobile devices (No IPN posted data from PayPal)? My form:
<form action="https://www.sandbox.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="hug33472-facilitator#hugtech.com">
<input type="hidden" name="item_name" value="Power-Ball Roller Android App">
<input type="hidden" name="item_number" value="PBRAND0114">
<input type="hidden" name="amount" value="1.37">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://hugtech.com/cgi-bin/pbandroid/secret">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cancel_return" value="http://hugtech.com/power_ball/mob">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Thanks, Larry
It sounds like you're confusing PDT and IPN. They're very similar except that PDT is meant to send data back to your return URL while IPN is meant to send data to an entirely separate script that isn't part of your checkout flow. IPN is the recommended method of updating your database, sending out emails, etc. Based on what you're saying about clicking the return link, though, you must be using PDT.
I haven't specifically tested PDT with mobile checkouts, but I know IPN does trigger regardless of the payment method or device. So make sure you're using IPN, not PDT, and you'll be fine.
I am trying to set up PayPal's IPN for custom cart use. But somehow it does not work. Can you guys have a look at the PayPal button code I am using? Do you notice any problems? Once I click on the Pay button, I am taking to PayPal's page that has the follow message:
We have detected a problem with this shopping cart. If the problem persists, please contact the merchant.
Questions:
What is the right way to name these variables: item_numberX or item_number_X? And the same with variables responsible for: price, name, and quantity. Do I need to add the underscore?
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="item_name_1" value="Service 1">
<input type="hidden" name="amount_1" value="148.00">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="mc_gross_1" value="148">
<input type="hidden" name="item_number_2" value="2">
<input type="hidden" name="item_name_2" value="Service 2">
<input type="hidden" name="amount_2" value="30.00">
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="mc_gross_2" value="30">
<input type="hidden" name="return" value="http://www.sitename.com/thank-you/">
<input type="hidden" name="notify_url" value="http://www.sitename.com/ipn.php">
<input type="hidden" name="first_name" value="Peter" />
<input type="hidden" name="last_name" value="James" />
<input type="hidden" name="payer_email" value="alex111#gmail.com" />
<input type="hidden" name="item_number" value="144" / >
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"
border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
Thank you.
You have most of the button right, the only variables I see issues with are "mc_gross_x", "payer_email" and "item_number". I am not sure where you got mc_gross_x at, but this would not be used in a button, you may have it confused with an IPN variable. As for payer_email, again you may have this confused with an IPN variable. If you are trying to populate the buyers email address on the PayPal payment page, it would just be "email". Also, you do not need to pass "item_number", since you are using the cart upload method, you would just use the format that you are already using up above in your code"item_number_x".
If the button still does not work for you, I would need to see the rest of the bottom code to see why it is not working.
I am using this code I found:
<form name="_xclick" 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="me#example.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="a3" value="5.00">
<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="sra" value="1">
</form>
When you generate a button from paypal site, it gives you the option to select the link where to send the ipn. My question is, how do I get the ipn confirmation using the code above or how do I set the link for it?
To add IPN notifications to this button specifically you can just add an additional hidden field to the form.
<input type="hidden" name="notify_url" value="http://www.domain.com/ipn-listener.php" />
That will only trigger an IPN for the initial transaction, though. If you want to get IPN's for all payments associated with this profile from there on you'll need to configure IPN in your PayPal account profile under the Instant Payment Notification Preferences section. Simply turn it on and set the URL you want to use.
At that point, the account profile setting will be sort of a default IPN that your account will use for all transactions. However, this can be overridden using notify_url (or NOTIFYURL in API requests.)
Hope that helps.
I use on my site Paypal hosted bottons. When visitors click buttons on my site, a process all data on server, after that i get from paypal via api special link and simply redirect visitors to Paypal
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XXXXXXXXXXXXX
All data like paypal account, custom field, prices and sicounts are safe.
Now I want to implement third party shopping cart on my site. I want to prepare all data like product name, price, discounts, coupons, special offers, etc on server side and redirrect visitors to paypal
But I can't find analog of hosted button for shopping cart form on Paypal manuals
So I should to use usual form with hidden fields
<div>
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="my#email.com">
<input type="hidden" name="custom" value="asgasgasgagahsdgsdghsgag">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="return" value="http://return.link">
<input type="hidden" name="cancel_return" value="http://cancel.link">
<ul>
<li>
<input name="quantity_1" value="1">
<input type="hidden" name="item_name_1" value="Product 1">
<input type="hidden" name="amount_1" value="25.01">
<input type="hidden" name="discount_amount_1" value="5.00">
</li>
<li>
<input name="quantity_2" value="1">
<input type="hidden" name="item_name_2" value="Product 2">
<input type="hidden" name="amount_2" value="12.71">
<input type="hidden" name="discount_amount_2" value="5.00">
</li>
</ul>
<input type="submit" value="Checkout">
</form>
</div>
I don't like this way, cause data like account email, custom variable, prices and discounts are note safe
Is there any analog of hosted button for shopping cart in paypal?
I would recommend using the Express Checkout API instead of Payments Standard. This gives you complete freedom to customize the checkout solution the way you need to and use your own dynamic variables, etc. but everything is nicely hidden from users because it all happens over the API.
I have to make a paypal integration in my website for paying person.I found a simple code
<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
To pay with PayPal now please click on the PayPal icon below:
<input type="hidden" name="cmd" value="_xclick"><br>
<input type="hidden" name="business" value="your#paypal.email"><br>
<input type="hidden" name="item_name" value="Order #{$order_id}"><br>
<input type="hidden" name="amount" value="{$order_amount}"><br>
<input type="hidden" name="currency_code" value="{$currency_iso_3}"><br>
<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but01.gif" alt="Pay with PayPal"><br>
< /form>
Is this secure for payment ?
You are sending the information over SSL/TSL.
If all the certificates are current and valid, you should be fine (so MITM attacks are less likely).
It is what banks and other financial and retail organizations are using - should be OK.
However, you did not really specify your requirements for secure integration - can you provide more information?