Integrating PayPal Sandbox to Your Web Application - paypal

I have a web application and I want to integrate the PayPal Sandox to it.
What are the steps to do so?

Since PayPal's integration guides can be unclear for beginners and other online tutorials can be too long for a simple checkout implementation, this Q&A aims to integrate the PayPal Sandbox to your web application quickly and easily. No external libraries or other downloads required.
STEP 1: Create a PayPal Sandbox Account. Follow this guide for test account creation.
STEP 2: Copy below sample HTML code for a basic Buy Now button (Single-Item Payment only):
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="payments#yourbusiness.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Your Product">
<input type="hidden" name="amount" value="25.00">
<input type="hidden" name="currency_code" value="USD">
<!-- Specify checkout options. -->
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="http://www.yoursite.com/paymentsuccessful.hmtl">
<input type="hidden" name="cancel_return" value="http://www.yoursite.com/paymentcancelled.hmtl">
<!-- Display the payment button. -->
<input type="image" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif">
</form>
form action - value is https://www.sandbox.paypal.com/cgi-bin/webscr, removing "sandbox"
means you are using the live PayPal website
business - does not have to be a real email, text displayed at the upper-left portion of the PayPal checkout page
cmd - _xclick means the button clicked was a Buy Now button
item_name - name of your product
amount - price of your product
currency_code - read here for supported values
no_note - do not prompt buyers to include a note with their payments (0 - false, 1 - true)
no_shipping - do not prompt buyers for a shipping address (0 - prompt but not required, 1 - do not prompt, 2 - prompt and require)
return - URL to which PayPal redirects the buyer's browser after they complete their payment
cancel_return - URL to which PayPal redirects the buyer's browser if they cancel checkout before completing their payment
Output:
References:
Testing Classic API Calls (recommended reading)
Single-Item Payments – Buy Now Buttons (more options available)
HTML Variables for Displaying PayPal Checkout Pages (more options available)

Related

Paypal not accepting payments on mobile device with credit card

When I use Paypal for checkout on my website, Paypal is showing checkout without Paypal account on Desktop but not on a mobile device.
Do you know could be the reason for this?
This is the form I use to redirect a user to the Paypal checkout page:
<form action="https://www.paypal.com/cgi-bin/webscr" name="paypalForm" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="#######gmail.com">
<input type="hidden" name="item_name_1" value="Product X">
<input type="hidden" name="amount_1" value="<?php echo $price; ?>">
<input type="hidden" name="custom" value="<?php echo $orderKey; ?>">
<input type="hidden" name="SolutionType" value="sole">
</form>
The form is being submitted by JS.
Thanks in advance!
using PayPal standard buttons, or ExpressCheckout, in some instances buyers will be able to pay with a debit/credit card and in some others they will only be able to open an account.
This can depend on many factors such as cookies, mobile/web, time of the day, and many other internal security variables which makes it impossible to predict. You could try to use the variable: solution_type = SOLE, it will give more chances to show the pay with card option but is not guaranteed.
If you wish to process card payments and you have a UK, USA or Canadian account you can think at PayPal Pro:
- for US / Canada, PayPal Payments Pro (https://www.paypal.com/webapps/mpp/paypal-payments-pro)
- for UK, PayPal Website Payments Pro (https://www.paypal.com/uk/webapps/mpp/pro)

remove Paypal create account in debit or credit card section

I'm building a website and want to add "Paypal" payment method
so I add this Html Form to site page
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="paypalemail#gmail.com">
<input type="hidden" name="item_name" value="My Cart Item 1">
<input type="hidden" name="amount" value="10.00">
<input type="hidden" name="shopping_url" value="http://localhost:2718/school/paymeant.aspx">
<input type="hidden" name="return" value="http://localhost:2718/school/paymeant.aspx?sucess=1">
<input type="hidden" name="cancel_return" value="http://localhost:2718/school/paymeant.aspx?faile=1">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
all is going ok expect when user want to pay me throw credit or master or visa card
then paypal ask them to create account to pay throw that card how can i remove
create account option in debit or credit card section
The method you are using for adding a PayPal button to your is called Payments Standard. This integration method is quick and easy, but it has some limitations.
What you're after, where users can just pay with a credit card without logging in or creating an account, is called "guest checkout". Unfortunately, with Payments Standard guest checkout relies on browser based cookies. As such, if anybody has ever signed in to a PayPal account with that particular browser the system is going to assume you'll be using PayPal, so it sort of hides away the guest checkout option. You should still see a link that allows you to get there, but it's very easy to miss.
If you were to try that in a fresh browser or clear the cache/cookies in your current browser you would probably see the guest checkout experience.
If you want to force the guest checkout experience at all times regardless of browser cookies you'll need to use the Express Checkout API instead of Payments Standard. This will require the use of a programming language like PHP.
Assuming you are familiar with that, you could use this PHP PayPal SDK to easily integrate Express Checkout. It comes with free samples that would probably be enough to get you going.
Alternatively, if you are using a CMS of some kind there is probably a plugin available that would make Express Checkout integration easy for you. For example, if you're using WooCommerce, by chance, I would recommend taking a look at PayPal for WooCommerce.

Paypal - Dynamic Buy button to charge our clients customer

I need to implement a method where we can allow a clients customer to make a payment to the client via our website - all of which will be setup via our custom CMS.
Our initial plan was to use the following form script to generate a transaction and ask the client to add a return address to our website.
<form name="_xclick" action="https://www.paypal.com/uk/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="someone#someon.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="2 x sessions">
<input type="hidden" name="amount" value="50">
<input type="image" class="btn btn-default nom paypalBtn" src="" border="0" name="submit" alt="£50">
</form>
This would potentially work fine - as we could dynamically add the value, business email and item name. Though we are worried that any web savvy person could simply inspect the form in a browser and change the payment value to a more pleasing figure! So we feel we need a better solution.
Does anyone have any suggestions for a cleaner solution?
Log into your PayPal account, click on Merchant Services at the top of the page and then click one Create Payment Buttons for your website. When you create buttons on PayPal they are hosted and secure.

PayPal buynow button setting issue

I am trying to test my PayPal "buy now" button. It goes to sandbox page successfully and I do payment from my developer account. Problem is that my that payment do not go to my developer business account after paying with my developer personal account.
Here is my code:
<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="my-developer-business-id#gmail.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="test product">
<input type="hidden" name="return" value="some return url">
<input type="hidden" name="amount" value="1">
<input type="image" src="http://www.paypal.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>
Please also tell me how can I make shipping option off... I don't need any shipping option here.
You can try creating button from sandbox account's website.
Steps to create PayPal button:
Login to your seller's test account in sandbox.
Click on 'Merchant Services' tab.
There you will find Create PayPal payment button
Fill out the form as per your requirement.
This will generate a HTML script.
Create a HTML file and copy paste this HTML script. Open the HTML file, You will get a Paypal Button.
Click it and accept transaction by buyers PayPal account.

Paypal not calling IPN script at all on my web server

I'm trying to use Paypal IPN on a website.
The payment works and is marked as "completed".
The return url works.
An email is sent notifying the payment is done
But it seems paypal doesn't talk to the IPN script. When checking with Wireshark, there is no communication with my website when the payment is sent.
Could it be because this communication is embedded inside an SSL communication and not in non-secure HTTP?
Could my server refuse to process the IPN request from Paypal?
I thought it would work out of the box, but no. It seems it doesn't reach my server, and Paypal doesn't return something like "your server refused to receive IPN infos". So Paypal is just not calling IPN script.
I'm 99% sure my request in correct, but here's the button I made:
<form action="<%=paypalurl%>" method="post" target="_blank">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<%=appsettings.paypalemail%>">
<input type="hidden" name="item_name" value="<%=appsettings.paypalitem%>">
<input type="hidden" name="item_number" value="<%=appsettings.paypalid%>">
<input type="hidden" name="amount" value="<%=appsettings.paypalamount%>">
<input type="hidden" name="currency_code" value="<%=appsettings.paypalcurrency%>">
<input type="hidden" name="custom" value="<%=userid%>">
<input type="hidden" name="notify_url" value="http://www.mysite.com/ipnscript.aspx">
<input type="hidden" name="return" value="http://www.mysite.com/ppreturnurl.aspx">
<input type="hidden" name="cancel_return" value="http://www.mysite.com/ppcancelurl.aspx">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Did you make sure that IPN is enabled?
Account -> My Profile -> Instant Payment Notification Preferences
Secondly I would check the IPN History
Account -> History -> IPN History
This will allow you to see the status and re-send it if need be.
I am assuming you are using the sandbox to test this out first.
As of 2013-06-20, if you have a Business account, to enable IPN messages:
(Log into PayPal) > Profile > My Selling Tools > Getting paid and managing my risk / Instant payment notifications / Update > Choose IPN Settings > (o) Receive IPN messages (Enabled) > Save
*Note: you can leave "Notification URL" blank if you provide a "notify_url" field in your payment form / button code.