Paypal - Dynamic Buy button to charge our clients customer - paypal

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.

Related

PayPal: skip trial period

I have created a hosted PayPal button for monthly subscription and included its code on my website.
The subscription offers a free trial period of 1 week.
I would like to check if the user has already used their trial and is trying to subscribe again. And if so, how do I let PayPal know that it should not allow a trial period for that user?
The button's code looks something like this:
<form action="https://www.sandbox.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="ABCDEFGHIJKLM">
<input type="hidden" name="on0" value="Your email">
<label for="plan-email">Your email</label>
<input id="plan-email" type="email" name="os0" placeholder="joanne.doe#gmail.com" required maxlength="200">
<button type="submit">Subscribe</button>
</form>
It would be even better, if you know a way to use Subscription Plan (created in https://www.paypal.com/billing/plans) as an HTML form similar to the one above (pure HTML form, without using PayPal JavaScript SDK) instead of a Button (created in https://www.paypal.com/buttons/). I need to pass an extra option (user's email) to PayPal as well as whether to allow a trial period or not.

Why would paypal notification URL different

Okay, so we have a member site using Joomla, and a component that allows users to perform certain tasks (creating teams). They are allowed to login, and create a team, but they can't add members to this team until they pay a $25.00 fee.
This happens through Paypal IPN. There is essentially this form below... (some personal data removed).
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="<?php echo $item_name;?>">
<input type="hidden" name="business" value="blah#blah.com">
<input type="hidden" name="amount" value="25">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="no_note" value="1">
<!--<input name="userId" value="<?php //echo $user->id;?>" type="hidden">-->
<!--<input name="task" value="paypal_register" type="hidden">-->
<input type="hidden" name="currency_code" value="USD">
<!-- Enable override of buyers's address stored with PayPal . -->
<!-- Set variables that override the address stored with PayPal. -->
<input type="hidden" name="return" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register';?>">
<input type="hidden" name="notify_url" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register&userId='.$user->id.'&ipn=1';?>">
<!--<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>
Now sometimes the IPN redirects and works just fine. But other times it cuts the url short from "index.php?option=com_fastball&view=payment&task=paypal_register&userId=" to "index.php?option=com_fastball", therefore not activating the view in Joomla that contains the code to update the database on notification.
It seems fairly random. There are several scenarios, 1 - New User Creating New Team. 2 - Old User Creating New Team. 3- Old User Renewing Old Team.
But regardless of that, they ALL hit this payment form button with THESE notify URL as hidden input.
So I'm not sure where paypal is either A.) Getting the shortened URL, or B.) They are cutting it short for some reason. It returns to the shortened URL with all of the Paypal Post info showing in the URL Parameters (&st=Completed&amt=25.00 etc from paypals servers)
This has been extremely frustrating and I may not have explained it well so if you have any questions or thoughts, just let me know. Thanks!
For URL paths you should use JURI::base() not JURI::ROOT. You can check the documentation here https://docs.joomla.org/Constants.
This appears to be a recent PayPal problem. All the urls (return, cancel_return, and notify_url) PayPal is stripping the url of all content after the first '&'.
Note also that the issue appears to be intermittent; it may be dependent on the PayPal server you connect to (QueryString values removed from the IPN endpoint by PayPal).
I have made some modifications to my own PayPal form replacing just the '&' with '&' (the encoded version) and that seems to work.

How to integrate paypal on website

I have a paypal account but are completely new of how to set up a paypal solution on my website. I develop on my computer so the website is not up on the internet yet.
I will sell digital goods which are textfiles and ebooks.
I try to use the wizard: https://devtools-paypal.com/integrationwizard
So in step 2, this creates a button which I placed on my website including putting "paypalfunctions.php", "orderconfirm.php", "checkout.php", "cancel.php" in the rootdirectory of the website.
In the .php file, I have changed those to the ones in the sandbox:
$API_UserName="xxxxxx_api1.hotmail.com";
$API_Password="xxxxxxpassword";
$API_Signature="xxxxxxxxxxxxxxxxxxxxxxp.yxxxxxxxxx";
I have created a sandbox account here: https://developer.paypal.com/developer/applications
When I click the paypal button on my website. It opens up a small window which has the same content as my actual page on the website where I clicked the paypal button. I don't understand what is happening here.
Shouldn't paypal payment processing be opened in that window?
I don't know what I am missing to start to set this up correctly?
I don't really know where to begin?
Thank you
Stop trying to make it so difficult. Use my example below, it is extremely simple. This will give you an idea on how things work. Go from there.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="ITERMNAME HERE">
<input type="hidden" name="business" value="PAYPAL-EMAIL-ACCOUNT-HERE">
<input type="hidden" name="cn" value="CUSTOM FIELD HERE IF YOU WISH">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHosted">
<input type="submit" name="submit">SUBMIT</input>
If your file that contains the button does not reside in the same directory as the php files you setup your form will fail and probably render whatever your server used as a default.
<form action='expresscheckout.php' METHOD='POST'>
In this case it expects expresscheckout.php to reside in the same folder. You may need to adjust this, such as /expresscheckout.php or similar.

How to capture form info with PayPal transaction

I'm offering a backlink building service and I'd like to just offer a simple form on my site where the user can enter their:
Website they want me to rank
And 1-2 keywords they're looking to rank for
And then a simple PayPal button that directs them to where they can pay.
Does anyone have any resources they can point me to to capture that information, maybe even their PayPal email, once they make a purchase?
Are there any plugins or code anyone knows of that I can just swipe and modify with my form fields?
I know this has to be possible I just don't know what to type into Google to get more information.
Thanks in advance.
Basically there are two parameters that comes to my mind that you could use custom & no_note
custom is a parameter that you can use to collect the Website they want me to rank information and regarding keywords you can use no_note(but this has to be entered by the buyer in PayPal checkout page.Alternaltively, you can use `custom' parameter to append both the information and then make a payment.
Sample Form Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="XXX#gmail.com">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="custom" value="website_rank+keywords">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="paymentaction" value="sale">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Now, how to get this information after the buyer completes the
payment?
Use Instant Payment notification. and look at the IPN variables that you can get back

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.