Paypal hosted button analog for cart form - paypal

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.

Related

Paypal Express Checkout shows only one item

I am trying to use Paypal shopping cart in my web page:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="xxx">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="My Event Registration - Adult">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="item_name_1" value="My Event Registration - Child">
<input type="hidden" name="amount_1" value="10.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_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_US/i/scr/pixel.gif" width="1" height="1">
</form>
This code is mostly generated using PayPal Payment Button helper on PayPal's website.
It seems PayPal's website generates code only for a single item. As I needed two items, I added another item using input fields item_name_1 and amount_1.
When I click on the submit button, I am properly taken to PayPal's shopping cart. However, I see only one item in the cart. I was expecting to see both, Registration-Adult and Registration-Child, in the shopping cart.
I am wondering what is it that I am missing. Regards.
It seems the hidden field "add" can only add one item. You could use "upload" instead. However, in that case PayPal's shopping cart page does not get displayed. For our case, the shopping cart has to be shown so that users can change the number of items. My solution was to actually have two forms instead of one in the same webpage. This works. The only drawback is the user has to click on two buttons instead of one.

paypal buy button return the customer details

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/

Implementing PayPal IPN with custom cart use

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.

How to use paypal for products belongs to several sellers in a cart from a one transaction?

Friends, I am developing a website for product sales.Products can be submitted by different sellers.So if a buyer add different products from different sellers for his cart,I need to do the paypal process in a single transaction.
I have no problem with if the items are belongs to one seller as below
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="abc#abc.com">
<input type="hidden" name="item_name_1" value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="shipping_1" value="1.75">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="hidden" name="shipping_2" value="2.50">
<input type="submit" value="PayPal">
</form>
But if items are from different sellers,that makes me trouble. Do i need to loop all the items and submit each by each or Can you advise me to overcome this problem thanks.
try PayPal adaptive payments "parallel payments" APIs - https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_APIntro
You can download sample code/SDK from above same URL.

Is it possible make a PayPal 'Buy Now' button with an HTML form?

I have a Google Checkout 'Buy Now' button on my site. It's very simple, all I do is produce the order information in an HTML form thus:
<form action="https://checkout.google.com/cws/v2/Merchant/xxxxxxxxxx/checkoutForm" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm">
<input name="item_name_1" type="hidden" value="Some Stuff">
<input name="item_description_1" type="hidden" value="Product">
<input name="item_quantity_1" type="hidden" value="1">
<input name="item_price_1" type="hidden" value="0.25">
<input name="item_currency_1" type="hidden" value="GBP">
<input name="item_name_2" type="hidden" value="Delivery">
<input name="item_description_2" type="hidden" value="standard">
<input name="item_quantity_2" type="hidden" value="1">
<input name="item_price_2" type="hidden" value="2.5">
<input name="item_currency_2" type="hidden" value="GBP">
<input name="_charset_" type="hidden" value="utf-8">
<input alt="" src="https://checkout.google.com/buttons/buy.gif?merchant_id=xxxxxxxxxx&w=117&h=48&style=white&variant=text&loc=en_US" type="image">
</form>
This form is generated by a bit of PHP, it's fairly trivial to put together. Is there a way of creating a PayPal button in the same way? Some customers have requested it, but I don't have time to delve into complex APIs, and static saved buttons are no good (the customer fills out a short order form, which then generates the button).
Is this what you´re looking for?
=> http://net.tutsplus.com/tutorials/html-css-techniques/creating-a-paypal-payment-form/
=> https://www.paypal.com/cgi-bin/webscr?cmd=_pdn_xclick_techview_outside