Integrate PayPal without API - paypal

I need to integrate paypal in my site but without using API beacause it needs to put API key APY sescret and and Username. In my case there are different vendors in my site and they are not supposed to share there API credientials to my site. so I need to accept payment using emailid only.

If you do not want to use Rest API, Adaptive Payments, or Express Checkout, which all use API Credentials, you can use PayPal Standard buttons.
Below is a basic PayPal Add to Cart button example:
<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="youremail#youremail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Sample Add to Cart Button">
<input type="hidden" name="amount" value="10.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<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>
You can create a basic add to cart button in your PayPal account or you can use the PayPal Button Factory
Here are the basics of PayPal Payments Standard:
Basic PayPal Standard Integration Guide
PayPal Standard HTML Variable Guide

Related

PayPal Not Passing Amount For Donation

I'm building a website for a client that has to take donations. I want to have the donation value passed through and automatically filled when they land on PayPal. I have two different sets of code with two different errors.
I do not have access to my clients PayPal account so please let me know if it's not solvable on my end. I do have their merchant ID, which has been redacted in the below code with "merchantidgoeshere".
Code 1: Goes To Merchant Donation Form But Doesn't Pass The Value
<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="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
Code 2: Doesn't Go To Page And Redirects To Error Page With The Message:
We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="merchantidnumberhere" />
<input type="hidden" name="item_name" value="Donation Description">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="amount" value="15.00">
<br /><input name="submit" type="image" alt="PayPal - The safer, easier way to pay online!" src="https://www.paypalobjects.com/webstatic/en_US/i/btn/png/btn_donate_92x26.png" /><span class="lazy_container" style="width: 1px;"><span class="lazy_preloader" style="padding-top: 100%;"></span><img width="1" height="1" alt="" src="plugins/system/tmlazyload/blank.gif" class="lazy" data-src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" border="0" /></span>
</form>
The first button is a hosted button, so the amount details would have to be set at in the button wizard within the PayPal account. You won't be able to pass your own dynamic value using a hosted button.
The second one is working fine for me when I replace "merchantidnumberhere" with a valid account email address. Did you make sure to update the business parameter with a valid email address or account ID?
Just as a note, to force English as the language the code shouldn't be:
<input type="hidden" name="lc" value="US">
It should be:
<input type="hidden" name="lc" value="en_US">
Cheers from Spain!

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.

Automatically tick 'Make this recurring (monthly)'

I've got a donate page on a website I'm building for a charity. On the page they want to have two options: 'Donate' and 'Donate monthly'. These buttons should take you straight to the donations page on PayPal, however the client wants the 'Donate monthly' button to make the 'make this recurring (monthly)' box on the paypal site itself, pre-ticked.
Is there a way to do this by passing a parameter? Either via Query string or hidden input. Here is the code as it stands at the moment:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="paypal#clientemail.org">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Client Name">
<input type="hidden" name="item_number" value="Donate">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:donateBtnPaypal.png:NonHostedGuest">
<input class="btn shorter diavlo book" type="submit" value="Donate monthly (€)" 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>
What you could do is switch to the Express Checkout API. This would give you the ability to design those options into your own UI and pass it all over to PayPal however you want to.
If you're working with PHP my class library for PayPal will make it very easy on you. Specifically, you would be using:
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment
CreateRecurringPaymentsProfile
No, its not possible to make it as default option "Make This Recurring (Monthly)"

PayPal Payments Standard custom HTML form; How does PayPal know who is submitting?

I'm trying to get this form to initiate a donation using PayPal Payments Standard...
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="text" name="amount"></input>
<input type="hidden" name="item_name" value="OrganizationXYZ Donation">
<input type="hidden" name="image_url" value="http://www.OrganizationXYZ.org/images/logo.gif">
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
</form>
This seems like it should work according to PayPal's documentation, but it doesn't. Instead I get this error:
"We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com."
This error doesn't make any sense because you do not supply an email address in these forms. Yet it seems to me that my form needs to post some kind of identification- otherwise how would PayPal know which account is receiving the donation? Unless I register a domain vai my PayPal account settings, but there is no place to do that either.
Does anybody have experience with setting this up?
Yes, as you mentioned, it need some sort of identifier of the recipient.
What you need to add is the 'business' parameter. That's all.
<input type="hidden" name="business" value="your secure merchant account ID / email here">
You must to have a merchant account.
You can see a tutorial here: http://kb.worldsecuresystems.com/833/cpsid_83331.html
try this code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<select name="amount">
<option value="3.99">6 Months ($3.99)</option>
<option value="5.99">12 Months ($5.99)</option>
</select>
<br>
<input name="currency_code" type="hidden" value="USD">
<input name="shipping" type="hidden" value="0.00">
<input name="tax" type="hidden" value="0.00">
<input name="return" type="hidden" value="urlOnValidPayment">
<input name="cancel_return" type="hidden" value="UrlOnCancelPayment">
<input name="notify_url" type="hidden" value="URLForValidationPayement">
<input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="your e-mail">
<input name="item_name" type="hidden" value="name of the object">
<input name="no_note" type="hidden" value="1">
<input type="hidden" name="no_shipping" value="1">
<input name="lc" type="hidden" value="EN">
<input name="bn" type="hidden" value="PP-BuyNowBF">
<input name="custom" type="hidden" value="custom data">
<input type="image" src="https://www.paypalobjects.com/en_US/CH/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
for me it's work
¿Are you just generating the payment buton yourself?
I must recommend you to login to your PayPal account, go to this part of the menu:
Merchant Services -> Key Features -> Buy now Button
Then choose the button type I guess you want a Donate button.
Then configure the overall button settings, I must recommend to save the button in paypal servers.
Finally choose Create Button
This will give you the right HTML code. This is a sample donate button HTML.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="YOUR_BUSINESS_ID">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="myorgname">
<input type="hidden" name="item_number" value="donateid">
<input type="hidden" name="amount" value="20">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
<input type="hidden" name="custom_variable1" value="val1">
<input type="hidden" name="custom_variable2" value="val2">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_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>
Here is your problem:
<input type="hidden" name="cmd" value="_donations">
Paypal's image value in Encrypted Payment System (WPS - EPS) for "cmd" is "_s-xclick"
So use it as below:
<input type="hidden" name="cmd" value="_s-xclick">

Paypal buy now button takes to sandbox account login page

I am using Paypal buy now button on my website. For testing purpose I am using paypal sandbox account. The problem is when I click on buy now button, it takes me to sandbox sign in page when I have not already signed in. The following is my buy now button code
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="skariz_1316503728_biz#gmail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="PSYC">
<input type="hidden" name="amount" value="2.00">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="custom" value="test#test.com">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_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>
I believe the sandbox account buttons require you to log into your sandbox account to use it. If memory serves the last time I was working with an IPN I had to do that. There may also be a section where you create test customer sandbox accounts, but I can't recall.