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.
Related
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.
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.
I am using the following code to generate a "Buy Now" button for selling a single item.
It takes me to PayPal using the sandbox and does the payment but after I return nothing is received in the response (there is no extra parameter in the URL I get).
<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="steve.johntestemail#gmail.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Book_1">
<input type="hidden" name="amount" value="0.09">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="return" value="http://www.thequeenoflean.com.au">
<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!">
</form>
Will I get the data in get or post?
Actually I want to retrieve the email of the buyer and some other information as well.
Can anyone guide me what my mistake is here?
Thanks in advance.
i tried sandbox, live Paypal payment scenario but it was not working,
i tried so many tutorials but the steps mentioned in those tutorials were not working,
finally i got the reason:
i was trying to use Paypal from asian country where it is not supported and works abnormally,and that's why i was not getting response in return. if you use any other VPN with for example(american, Australian etc.. ips where it is supported) it will work fine and return you response accurately.
Thanks,
I know a reason why you're not getting any information.
take a look here: https://stackoverflow.com/a/11404356/279147
you see I have a notify_url parameter in my form, this is a url which will be called by paypal when the payment has been completed, whether it succeeds or fails.
the url is not opened by the browser, popups, etc, it's a "back channel" call to your server to just send data, there is no interaction with the client, so don't put any html, or return anything, it's just a "dead drop" url to dump data, if you put something like
<?php trigger_error(print_r($_POST,true)); ?>
in your code, your error log might show up some information, so then you know you are receiving information,
you're missing that, so you never get any information, unless the user clicks on the return to website button and in my experience that never happens. they just close the browser.
so take a look at my url, add the parameter and then try to do it again.
I'm trying to setup a registration form for some workshops that last a week. Basically, they can sign up for the workshops individually or the whole week. Depending on what they select, the price will change. I get how to send this information to paypal, however I also want to submit information to my own DB. How would I submit to paypal and file the info into my DB at the same time?
I also want to have a variable that is returned that verifies they have paid so I can mark it in my DB.
Would I just have another page that would put all this info into the DB (once submitted) then also put the info into hidden form fields and then automatically submit to paypal?
Thanks in advance! :)
"When payment is successful your user is returned to your self which is when you can record the payment in the db."
That's exactly what you shouldn't be doing.
Depending on a buyer to return to your website in order to update an order status is the worst thing you can do.
PayPal IPN was designed with especially this use case in mind.
Simply add in
This will ensure PayPal will POST to you whenever the payment has completed. Even if your buyer has already closed his/her browser.
You can use the 'custom' fields to link an IPN POST to a transaction made on your site. For example:
will ensure you get an IPN POST with $_POST['custom'] of '1122334455'. From there, it's simply a matter of making a db call to update the order status to 'paid', or whatever you use to mark it as payment received.
Oh, and don't forget to post the data back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate to validate the IPN POST. More info is available at https://www.paypal.com/ipn/
So I guess you are probably using Website payment standard.
If so the process is like this:.
Users signs up for a particular workshop using your form (select prices, time etc etc)
On submit you process the form (check validation etc)
If you happy with this then you generate a from that is automatically posted to paypal that looks like this:
<body onLoad="document.forms['paypal_auto_form'].submit();">
<p>Please wait</p>
<form method="post" action="https://www.paypal.com/cgi-bin/webscr" name="paypal_auto_form"/>
<input type="hidden" name="rm" value="2" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="currency_code" value="AUD" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="business" value="PAYPAL#EMAIL.COM" />
<input type="hidden" name="return" value="http://domain.com/paypal/success" />
<input type="hidden" name="cancel_return" value="http://domain.com/paypal/cancel" />
<input type="hidden" name="notify_url" value="http://domain.com/paypal/ipn" />
<input type="hidden" name="custom" value="1234567890" />
<input type="hidden" name="item_name" value="Paypal Test Transaction" />
<input type="hidden" name="item_number" value="6941" />
<input type="hidden" name="amount" value="197" />
<p><input type="submit" name="pp_submit" value="Pay Now!" /></p></form>
</body>
The values you of course customize to what you want. Look at Appendix A of the paypal documentation for the variables. You can also add your own log with cpp_header_image or something like that.
The users is taken to paypal to process payments
When payment is successful your user is returned to your self which is when you can record the payment in the db. You might use some for of key or cookie variable to track the payment they have made.
You probably want to use the IPN to double check that it was successfully paid.
If all this is too hard just use http://wufoo.com/ and add the payment module to the form.
I was hoping someone could help regarding modifying a subscription price.
I have a social networking site In which you originally could subscribe to a standard or premium account which varied in what applications where active in your account.
My client now whats to scrap the 2 subscriptions and be able to give a choice of what applications the user wants to use and charge a subscription cost for the total cost for the applications specified.
I have a 'bolt-ons' page in which the user clicks a checkbox associated with each application, which then processes the payment and the IPN makes modifications to their account which works fine.
But when a user decides they want more or less applications and fills out the form again, I can't figure out how to modify their payment.
when I add the modify variable to the html form and continue the payment, it brings me to a radio form with other subscriptions from different projects.
I simply want to modify the total outgoings of the users payments. It is the user the process's the form, there is nothing illegitimate going off, just simply looking for the user to be able to change the subscription rate which depends on what applications they want active.
here's my html form:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"
style="margin:20px;">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="******************************" />
<input type="hidden" name="item_name" value="************************ Application Bolt-on's" />
<input type="hidden" name="return" value="http://www.***************.co.uk/?navigation=home">
<input type="hidden" name="cancel_return" value="http://www.***************.co.uk/?navigation=home">
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="currency_code" value="GBP" />
<?php
if( isset( $post['mod'] ) ) {
echo "<input type=\"hidden\" name=\"modify\" value=\"2\" />";
echo "<input type=\"hidden\" name=\"a3\" value=\"00.02\" />";
}else{
echo "<input type=\"hidden\" name=\"a3\" value=\"00.01\" />";
}
?>
<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="sra" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="custom" value="<?php echo $custom_str; ?>" />
<input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_subscribeCC_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_GB/i/scr/pixel.gif" width="1" height="1">
</form>
I have read many articles and non touch on this subject in a sense of whether it can or cannot be done so please don't send me links the the paypal site unless it is the exact answer which I may have missed.
Any help is much appreciated,
Regards,
Phil
Hate to give such a partial non-answer to your question, but I think the information you need might be in the following blog post http://talklikeaduck.denhaven2.com/2007/09/02/how-to-cure-the-paypal-subscription-blues (Link is broken, but left here for attribution purposes)
From that article:
Another complexity of PayPal
subscriptions is how to allow users to
modify subscriptions. In fact this is
where I came in on this particular web
site. They had been offering only
monthly subscriptions and wanted to
offer an annual subscription with a
discount. The key here is to ensure
that you tell PayPal that you are
modifying a subscription rather than
creating a new one. The PayPal
documentation describes the ‘modify’
attribute which is to be passed with
the subscription signup request post
to paypal. A value of ‘1’ for this
attribute indicates that it will
modify an existing subscription, or
create a new one if there is no
existing subscription. Don’t beleive
this. My initial testing with the
PayPal developer sandbox seemed to
indicate that this worked. In practice
though, once deployed, it always
seemed to create a new subscription,
which meant that when a user upgraded
a monthly subscription to an annual
one, she ended up with both.
The fix was to use a value of ‘2’ for
modify when the user had an existing
subscription, and not to use the
modify attribute at all otherwise.
The article is dated 2007 and I would be careful to trust it as a current reference, but it might be a good starting point.