Paypal shopping cart with multiple items - paypal

I have developed a shopping cart and now I am stuck with paypal shopping cart form. I am trying to send multiple items with one single shipping, handling and tax fees. I have created following form but paypal gives me error "Your shopping cart is empty."
Here is my code
<form name="paypal" action="https://www.paypal.com/cgi-bin/webscr" ethod="post">
<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="business" value="xxxx#xxxxx.com">
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="tax_cart" value="5">
<input type="hidden" name="handling_cart" value="30">
<input type="hidden" name="shipping" value="20">
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="item_name_1" value="Product 1">
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="item_amount_1" value="60">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="item_name_2" value="Product 2">
<input type="hidden" name="item_number_2" value="4">
<input type="hidden" name="item_amount_2" value="10">
<input type="hidden" name="quantity_2" value="1">
<input type="submit" name="submit" value="Pay with Paypal" />
</form>

The name provided for the amount is incorrect. Instead of
<input type="hidden" name="item_amount_2" value="10">
use
<input type="hidden" name="amount_2" value="10">

The variable "handling_cart" should work. It wouldn't work if you have your account set up not to allow transaction based shipping to override your profile shipping. Double checking your shipping profile in your PayPal account and make sure you have it set to allow transaction based shipping to override your profile.

Related

PayPal HTML Button Missing Invoice Parameter

I implemented a Paypal HTML button (payment and subscription) to direct the client to the Paypal site to make a payment. Also, I pass the invoice # as a parameter. According to the following documents, invoice is a pass-through variable.
https://developer.paypal.com/docs/paypal-payments-standard/integration-guide/Appx-websitestandard-htmlvariables/#
https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/archive/PP_subscriptions.pdf
In fact, I do receive all parameters (including invoice) as a POST call when testing on my sandbox account. However, when I test on live payments (non-sandbox account), the invoice is not received. However, I receive other payment information such as item_number, custom, transaction id, etc. Also, with live payments, the information is passed through a GET call instead of a POST call.
In summary, why do I receive the invoice parameter from sandbox payments but not with live payments.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" name="return" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="hosted_button_id" value="...">
<input type="hidden" name="business" value="...">
<input type="hidden" name="item_name" value="...">
<input type="hidden" name="notify_url" value="..."
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="a3" value="...">
<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">
<input type="hidden" name="invoice" value="...">
<input type="hidden" name="custom" value="...">
<input type="hidden" name="item_number" value="...">
<input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" value="<%= (request.isSecure() ? "https" : "http") + "://" + request.getServerName() + "/upgradepayment" %>" name="return">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="...">
<input type="hidden" name="item_name" value="...">
<input type="hidden" name="amount" value="...">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="invoice" value="...">
<input type="hidden" name="custom" value="...">
<input type="hidden" name="item_number" value="...">
<input id="ok" type="submit" name="submit" value="Pay with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
edit: I receive the information about subscriptions with instant payment notification (IPN)
I just did a live payment using this code below (your HTML but modified a bit):
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="message">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<BUSINESS_PAYPAL_EMAIL>">
<input type="hidden" name="item_name" value="<ITEM_NAME>">
<input type="hidden" name="notify_url" value="<CALLBACK_URL>"
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="no_shipping" value="1">
<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">
<input type="hidden" name="invoice" value="<INVOICE_ID>">
<input type="hidden" name="custom" value="<CUSTOM_OPTIONAL>">
<input type="hidden" name="item_number" value="<ITEM_NUMBER>">
<input type="hidden" name="amount" value="<AMOUNT>">
<input id="ok" type="submit" name="submit" value="Pay and Subscribe with PayPal" alt="PayPal - The safer, easier way to pay online" title="PayPal - The safer, easier way to pay online">
</form>
I used https://requestbin.com/ to collect the IPN Callbacks. Here is the screenshot with the invoice:
Make sure you are correctly implementing IPN listener request-response flow.
Your listener should return an empty 200 message back to Paypal to these addresses;
https://ipnpb.sandbox.paypal.com/cgi-bin/webscr (for Sandbox IPNs)
https://ipnpb.paypal.com/cgi-bin/webscr (for live IPNs)
After that you get a VERIFIED message along with parameters.
Make sure to include invoice input (which seems like you already did) in the form.
The invoice is optional and is not passed back to you by default.
There is also an IPN simulator which you can try and make sure your listener is working correctly.
Here is a complete example on how to process IPN messages:
https://gist.github.com/xcommerce-gists/3440401

PayPal sandbox UK Payments Pro Hosted payment page does not process card

We are trying to integrate PayPal’s UK Payments Pro with the hosted payment page.
We have created a new sandbox UK business account and a UK customer account.
Each time we attempt to make a payment, we get this error:
This transaction can't be processed. Please pay with another card.
Here is the HTML for our POST:
<iframe name="hss_iframe" width="570px" height="540px"></iframe>
<form style="display:none" target="hss_iframe" name="form_iframe" id="form_iframe" method="post" action="https://securepayments.sandbox.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess">
<input type="hidden" name="buyer_email" value="nata#print-science.com">
<input type="hidden" name="last_name" value="dulger">
<input type="hidden" name="first_name" value="nata">
<input type="hidden" name="notify_url" value="http://xyzprinting.he18.printscience.net/paypalprohostedipn">
<input type="hidden" name="subtotal" value="21.03">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="cancel_return" value="http://xyzprinting.he18.printscience.net/paypal_cancel_2014?order=325558RL">
<input type="hidden" name="return" value="http://xyzprinting.he18.printscience.net/paypal_successful">
<input type="hidden" name="paymentaction" value="sale" />
<input type="hidden" name="template" value="templateD" />
<input type="hidden" name="business" value="ps-uk#printscience.com" />
<input type="hidden" name="cmd" value="_hosted-payment" />
<input type="hidden" name="address1" value="123 Cheapside">
<input type="hidden" name="city" value="London">
<input type="hidden" name="state" value="London">
<input type="hidden" name="zip" value="EC2 R 8AH">
<input type="hidden" name="custom" value="325558RL">
</form>
<script type="text/javascript">
document.form_iframe.submit();
</script>
Try changing the business value to the Secure Merchant ID value that is specified at the top of the Profile page of the Sandbox Test Site. The field should contain something like:
name="business" value="HNZ3QZMCPBAAA"
See the developer guide, p.64: https://www.paypalobjects.com/webstatic/en_GB/developer/docs/pdf/hostedsolution_uk.pdf

Payal Checkout. Change receiver's name

Instead of toaster#gmail.com (receiver's email) I need company name.
My code:
<form id="paymentform" action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="paymentform" method="post">
<input type="hidden" name="cmd" value="_ext-enter">
<input type="hidden" name="redirect_cmd" value="_xclick">
<input type="hidden" name="cn" value="My Dev Site">
<input type="hidden" name="business" value="toaster#gmail.com">
<input type="hidden" name="notify_url" value="http://toaster22.com/checkout/notify">
<input type="hidden" name="return" value="http://toaster22.com/checkout/success">
<input type="hidden" name="cancel_return" value="http://toaster22.com/checkout/cancel">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="handling" value="0.00">
<input type="hidden" name="tax" value="0.00">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="Order #427E-85FF-028E-E351">
<input type="hidden" name="invoice" value="427E-85FF-028E-E351">
<input type="hidden" name="amount" value="23.47">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="address_override" value="0">
</form>
What option can I use for that?
If you mean that you want to display the company name to the buyer in the PayPal flow, you simply use a receiver account that is registered as a Business account. You still identify the receiver by email in your button; nothing needs to change in the button.
PayPal will display the email address for an unregistered seller, the accountholder's name for a personal/premier account, and the business name for a business account.

Collecting user information

I need to collect information about our high school reunion attendees and allow them to pay via a PayPal button. I've created the PayPal Pay Now button, but not sure what if any information will be collected and sent back to me. Do I need a separate form to collect information or is there a way to make the PayPal button work as the submit button for the data I collect using a form?
You should use a IPN (Instant Payment Notification) for this. There are lots of good templates for this available on GitHub. Your form might look like this:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="business" value="YOUR PAYPAL ID">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="item_name" value="ITEM_NAME">
<input type="hidden" name="item_number" value="ITEM_NUMBER>
<input type="hidden" name="amount" value="TOTAL_AMOUNT">
<input type="hidden" name="custom" value="<?php echo $attendee_id ?>">
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Return to website">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="return" value="http://domain.com/success.php"/>
<input type="hidden" name="notify_url" value="http://domain.com/ipn.php"/>
<input type="hidden" name="cancel_return" value="http://domain.com/canceled.php"/>
<button type="submit">Pay using PayPal</button>
</form>

Why this PayPal daily recurring subscription doesn't process the next payment?

I'm testing PayPal Standard using PayPal Sandbox.
When I pay, PayPal creates a new subscription profile and charges me the first money. Everything is correct.
It's a $20 daily billing cycle, so the next day, it should charge me $20 at the same hour. Instead, it does nothing.
Today it's November 21th and in the PayPal account the subscription panel still says "next payment: November 20th". I have $9999 on Merchant and Client account too.
Should I edit my form code?
Here is the button code:
<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="info#myemail.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="custom" value="67;2;33789261736f93677856cfe698a9c9ca">
<input type="hidden" name="item_name" value="MENSILE (7b3e99ef1fb567b0151b1cbd8ec24627)">
<input type="hidden" name="max_text" value="Fino a 35 feeds differenti|Twitter, Linkedin e Facebook|Aggiornamenti software|Rinnovo automatico mensile|Supporto Email">
<input type="hidden" name="item_number" value="00001">
<input type="hidden" name="a3" value="20.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="D">
<input type="hidden" name="src" value="1">
<input type="hidden" name="sra" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="page_style" value="SOCIAL">
<input type="hidden" name="notify_url" value="http://www.mywebsite.com/members/site/ipn">
<input type="hidden" name="return" value="http://www.mywebsite.com/members/user/site/pricing/success?67;2;33789261736f93677856cfe698a9c9ca">
<input type="hidden" name="cancel_return" value="http://www.mywebsite.com/members/user/site/pricing">
<input type="image" style="width:200px;" class="aligncenter size-full wp-image-635" src="/members/themes/classic/images/subscriptions/buy2.png" border="0" name="submit">
</form>