473,796 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Paypal return

64 New Member
Hi there,

I am working on paypal payment gateway using php.
How can I set return url with some arguments

Thanks,
Yogesh
Jul 1 '07 #1
14 14452
kovik
1,044 Recognized Expert Top Contributor
Hi there,

I am working on paypal payment gateway using php.
How can I set return url with some arguments

Thanks,
Yogesh
What?

You mean how to make a query string?

"?var1=value1&v ar2=value2"


Be more specific.
Jul 1 '07 #2
ykhamitkar
64 New Member
What?

You mean how to make a query string?

"?var1=value1&v ar2=value2"


Be more specific.
Hi,

I am sorry, May be I was not clear.
Yes I want a query string.

Thanks,
Yogesh
Jul 2 '07 #3
luke14free
79 New Member
Maybe when he wanted more infos he meant to specify in which part of the code you need to put that and things like that...It would be great for us to help you with your code if you could post a pseudo code.
However as he said this is the sintax for GET
www.somesite.co m?var1=2 and so on...
Jul 2 '07 #4
ak1dnar
1,584 Recognized Expert Top Contributor
Hi there,

I am working on paypal payment gateway using php.
How can I set return url with some arguments

Thanks,
Yogesh
Hi Yogesh,
You can Send a hidden form field named return with theOther form elements

[PHP]
$paypal_site_ur l='http://www.thescripts. com/thanks.php';
<input type="hidden" name="return" value="<?=$payp al_site_url?>">


[/PHP]

If you need further details about Paypal IPG integration, you are welcome here.

Thanks,
-Ajaxrand
Jul 2 '07 #5
ykhamitkar
64 New Member
Hi Yogesh,
You can Send a hidden form field named return with theOther form elements

[PHP]
$paypal_site_ur l='http://www.thescripts. com/thanks.php';
<input type="hidden" name="return" value="<?=$payp al_site_url?>">


[/PHP]

If you need further details about Paypal IPG integration, you are welcome here.

Thanks,
-Ajaxrand

Thanks for your input Ajaxrand,
Let me explain the scenario.
I a working on a site where user updates details in a form and data gets updated in the database.

1. User Updates form with his unique UserID
|
2. Data goes in database
|
3. Column Payment_status from database is marked as "Not Done"
|
4. User is redirected to Paypal site
|
5. User makes the payment
|
6. Paypal redirects to my site on payment completion
|
7. Payment_Status column is marked as "Done" for that particular UserID

Now what I want to do is when I redirect(step 3) the site to paypal I also want to set Return parameter with parameter UserID.

So when user comes back to my site I can use the UserID to change value in database.

I read somewhere about rm parameter. But not sure how to use that.

I am new to payment gateway. so please help.

Thanks,
Yogesh
Jul 2 '07 #6
ak1dnar
1,584 Recognized Expert Top Contributor
rm is stands for Return Method

Expand|Select|Wrap|Line Numbers
  1. $paypal_return_method="2"; //1=GET 2=POST
  2. <input type="hidden" name="rm" value="<?=$paypal_return_method?>">
  3.  
You can set either GET or POST method. Then once user press the complete button from Paypal side you can retrieve the Completed transaction info back to your site.

To the page that I mentioned in my ealier post.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="return" value="Complete_URL_to_the Success_page.php">
  2.  
  3.  
Here at success.php (IF rm is POST), You can print back the completed transaction details to the customer.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?=$_POST['txn_id']?>
  3. // This is only the transaction ID
  4. // There are Lots like this refer to Paypal web site for more
  5.  
But issue is here,some times user might NOT press the button to merchant web site.
In that case you can use IPN functionality.
This is set by
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="notify_url" value="complete_URL_to_IPN.php">
  2.  
Sending this form field to paypal. Then once payment made this url will fire without pressing return back to your site.

When you send this notify_url you can send the User ID to Paypal and get it back by GET request.
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="notify_url" value=" http://www.site.com/ipn.php?userid=1001">
  2.  
Thanks
-Ajaxrand
Jul 3 '07 #7
ykhamitkar
64 New Member
rm is stands for Return Method

Expand|Select|Wrap|Line Numbers
  1. $paypal_return_method="2"; //1=GET 2=POST
  2. <input type="hidden" name="rm" value="<?=$paypal_return_method?>">
  3.  
You can set either GET or POST method. Then once user press the complete button from Paypal side you can retrieve the Completed transaction info back to your site.

To the page that I mentioned in my ealier post.

Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="return" value="Complete_URL_to_the Success_page.php">
  2.  
  3.  
Here at success.php (IF rm is POST), You can print back the completed transaction details to the customer.
Expand|Select|Wrap|Line Numbers
  1.  
  2. <?=$_POST['txn_id']?>
  3. // This is only the transaction ID
  4. // There are Lots like this refer to Paypal web site for more
  5.  
But issue is here,some times user might NOT press the button to merchant web site.
In that case you can use IPN functionality.
This is set by
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="notify_url" value="complete_URL_to_IPN.php">
  2.  
Sending this form field to paypal. Then once payment made this url will fire without pressing return back to your site.

When you send this notify_url you can send the User ID to Paypal and get it back by GET request.
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="notify_url" value=" http://www.site.com/ipn.php?userid=1001">
  2.  
Thanks
-Ajaxrand

Thank you so much Ajaxrand. Nice information
Jul 8 '07 #8
ykhamitkar
64 New Member
Thank you so much Ajaxrand. Nice information

Hi I tried the notify_url but it didnt work can you see if I am doing any error.
or do i need to change any any setting in paypal site to activate notify_url


Here is my html code for the form
=============== =============== =============== ===
Expand|Select|Wrap|Line Numbers
  1. <input type="Hidden" name="cmd" value="_xclick">
  2. <input type="Hidden" name="business" value="username@hotmail.com">
  3. <!-- Allow customer to enter desired quantity -->
  4. <input type="Hidden" name="undefined_quantity" value="1">
  5. <input type="Hidden" name="item_name" value="Registraion">
  6. <input type="Hidden" name="item_number" value="">
  7. <!-- No currency_code variable has been specified, so monetary amount is assumed to be USD -->
  8. <input type="Hidden" name="amount" value="10">
  9. <! Passthrough variables for order tracking or other purpose -->
  10. <input type="Hidden" name="custom" value="">
  11. <input type="Hidden" name="invoice" value="">
  12. <input type="Hidden" name="charset" value="">
  13. <input type="Hidden" name="no_shipping" value="1">
  14. <input type="Hidden" name="return" value="">
  15. <input type="Hidden" name="cancel_return" value="">
  16. <!-- Do not prompt customer to include a note with the purchase -->
  17. <input type="Hidden" name="no_note" value="1">
  18. <input type="Hidden" name="rm" value="2">
  19. <input type="Hidden" name="notify_url" value="">
  20. <input id=UserName style="WIDTH: 165px" tabindex=1 maxlength=16 name="Name">
  21. <input id=PasswordVerify style="WIDTH: 165px" tabindex=3 type=text maxlength=15 name="Phone">
  22. <input id=EMail style="WIDTH: 165px" tabindex=4 name="Email">
  23. <input type=submit value=Submit Now name=Authorize onClick="updatevaluesonsubmit()">
  24.  
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="text/JavaScript">
  2. function updatevaluesonsubmit() 
  3.  
  4. notify_url = "http://mysite.com/Payment-Complete.php?";
  5. notify_url = notify_url + "Name=" + frm.Name.value;
  6. notify_url = notify_url + "&Phone=" + frm.Phone.value;
  7. notify_url = notify_url + "&Email=" + frm.Email.value;
  8. notify_url = notify_url + "&Country=" + frm.Country.value;
  9. notify_url = notify_url + "&Product=" + frm.Registraion.value;
  10. notify_url = notify_url + "&Amount=" + frm.amount.value;
  11. frm.notify_url.value = notify_url;
  12. </Script>
  13.  
****

When user clicks on submit I am running updatevaluesons ubmit javascript to update notify_url field (I checked this and it works fine)
then it opens paypal site but when user makes payment it does not run Payment-Complete.php.

here is the code of Payment-Complete.php to send email. but it does not send email
=============== =============== =============== =========
Payment-Complete.php:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // multiple recipients
  3. $to = 'ykhamitkar@gmail.com'; //
  4. $companyname = 'My comany';
  5.  
  6. //Put name of cc. put " $cc = '' " if not required
  7. $cc = 'yogesh@teamags.com';
  8.  
  9. //Put name of bcc. put " $bcc = '' " if not required
  10. $bcc = '';
  11.  
  12. // subject
  13. $subject = 'Payment Complete';
  14.  
  15. // message
  16. $mailBody = '';
  17. $mailBody = $mailBody . '
  18. <table border="0" bordercolor="#000000" rowheight="30" width="400" cellspacing="1" celpadding="1">
  19. <tr>
  20. <td align="center" bgcolor="#CCCCCC" colspan="2" height="30"><b>
  21. <font face="Arial" size="2">Personal Details</font></b></td></tr>';
  22.  
  23. $mailBody = $mailBody . '<tr>
  24. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Name : </td>
  25. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  26. $mailBody = $mailBody . $_REQUEST['Name']."</td></tr>";
  27. $mailBody = $mailBody . '<tr>
  28. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Email : </td>
  29. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  30. $mailBody = $mailBody . $_REQUEST['Email']."</td></tr>";
  31.  
  32. $mailBody = $mailBody . '<tr>
  33. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Phone : </td>
  34. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  35. $mailBody = $mailBody . $_REQUEST['Phone']."</td></tr>";
  36.  
  37. $mailBody = $mailBody . '<tr>
  38. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Product : </td>
  39. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  40. $mailBody = $mailBody . $_REQUEST['Product']."</td></tr>";
  41.  
  42. $mailBody = $mailBody . '<tr>
  43. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Amount : </td>
  44. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  45. $mailBody = $mailBody . $_REQUEST['Amount']."</td></tr>";
  46.  
  47. $mailBody = $mailBody . '<tr> 
  48. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Country : </td>
  49. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  50. $mailBody = $mailBody . $_REQUEST['Country'].'</td></tr></table><BR><BR>';
  51.  
  52. $mailBody = $mailBody .'<font face="Arial" size="2">Thank you, <br><br>';
  53. $mailBody = $mailBody .'from<b> ' . 'ABC.com' . '</b><br><br><br></font>';
  54.  
  55.  
  56. $headers = '';
  57. // To send HTML mail, the Content-type header must be set
  58. //$headers = 'MIME-Version: 1.0' . "\r\n";
  59. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  60.  
  61. // Additional headers
  62. $headers .= 'To: ' . $companyname . '<' . $to . '>' . "\r\n";
  63. $headers .= 'From: '.$_REQUEST['Name'].' <'.$_REQUEST['Email'].'>' . "\r\n";
  64.  
  65. if ($cc!='')
  66. {
  67. $headers .= 'Cc:' . trim($cc) ."\r\n";
  68. }
  69.  
  70. if ($bcc!='')
  71. {
  72. $headers .= 'Bcc: ' . trim($bcc) . "\r\n";
  73. }
  74.  
  75. // Mail it
  76. mail($to, $subject, $mailBody, $headers);
  77.  
  78. //Open thank you page
  79. //include("thank-you.htm");
  80. ?>
  81.  
=============== ====


Please help!!

Thanks,
Yogesh

PLEASE USE [code] Tags - Ajaxrand
Jul 8 '07 #9
ak1dnar
1,584 Recognized Expert Top Contributor
when user makes payment it does not run Payment-Complete.php.
If you not getting a mail the problem is with your mail script. but note that you cant see the page(s) anyway (payment_comple te page, Thankyou page ).Its Completly hapening on the server side.
Server-Server Comunication
when Calling from client to server only you can see the page.

Read my previuos post to find out the diferences between
return
notify_url
Read it here
Link 1
Link 2

Thanks Thread is still open for you.come back any time.
Jul 9 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4775
by: Vinod | last post by:
Hi I am having a payment website which needs to be integrated, i am having the following code which is not working fine. I am having the following script and my notifyurl is not working i don't know why can guys please help me up <% if SIGNUP_PRICE > 0 then
4
2447
by: Mark | last post by:
Hi all, I have an ASP.NET application which I use to call paypal. I pass in the success URL as http://www.somedomain.com/success.aspx I go right through the paypal process and I finally get the "Return to merchant" button on the PayPal screen. If I look at the source code of the Paypal page the form action looks like
2
4184
by: Tommy | last post by:
I have written some code to use paypal for users to make purchases from my site. I am using the paypal instant payment notification. When i get the notification from paypal I send the user an email with registration key. I can pass data to that page with the custom field with no problem. The problem is after I redirect from my page to paypal. When I click the return button on paypal at the end of the purchase process all of my session...
7
2584
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the transaction details in plain text in the querystring, meaning that any rank novice can click the Buy button on your site, then when the PayPal page loads, change the amount for the transaction and press Enter. This reloads the page with the new amount. This is so obvious that anyone could do it.
5
2740
by: Jason James | last post by:
Guys, it seems that several people have enquired about how to communicate with Paypal as securely as possible. It is obvious that placing the shopping cart details in the URL is about as insecure as could be. Therefore why not use a POST and hide them in hidden variables? Well I would if I could figure it out. The contents of the cart are created dynamically and since I already have a button on my form that needs to be captured by...
0
1751
tolkienarda
by: tolkienarda | last post by:
hi all most of you have seen this form, mostly it has hidden attributes some of which can be changed to select boxes. the part that seems to be a security flaw is that people can edit live html with the web developer toolbar on firefox. i've gone into one of my clients orderforms and bought an expensive item for only five dollars and paypal never caught on. below is the code that now anyone with any knowldge of html can edit live and...
0
1756
by: Nicodemus | last post by:
Do You Belive? \ cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3 @w34g2000prm.googlegroups.com:
5
2395
by: HawkMan24 | last post by:
I submitted this on another PHP/Ajax forum and no one was able to figure it out. I am trying to return to a form from Ajax after clicking on a PayNow button and I want to return true or false depending on if it was able to write a record to my database from a php script. Everything works fine if the record gets written (it continues to PayPal) or if somemone leaves out a required field (it displays a message and stays on the page). But my...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.