473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Paypal return

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 14376
kovik
1,044 Expert 1GB
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&var2=value2"


Be more specific.
Jul 1 '07 #2
What?

You mean how to make a query string?

"?var1=value1&var2=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
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.com?var1=2 and so on...
Jul 2 '07 #4
ak1dnar
1,584 Expert 1GB
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_url='http://www.thescripts.com/thanks.php';
<input type="hidden" name="return" value="<?=$paypal_site_url?>">


[/PHP]

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

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

[PHP]
$paypal_site_url='http://www.thescripts.com/thanks.php';
<input type="hidden" name="return" value="<?=$paypal_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 Expert 1GB
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
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
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 updatevaluesonsubmit 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 Expert 1GB
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_complete 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
If you not getting a mail the problem is with your mail script. but note that you cant see the page(s) anyway (payment_complete 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.

======

Hi Ajaxrand,

I tried the notify url and it works well.

Thanks for your help

Yogesh
Jul 18 '07 #11
ak1dnar
1,584 Expert 1GB
======

Hi Ajaxrand,

I tried the notify url and it works well.

Thanks for your help

Yogesh


Its a pleasure to hear that Yogesh. good luck with your project.
Hope to see you again here @ TSDN.
Thanks!
-ajaxrand
Jul 19 '07 #12
please help me to integrate the paypal direct method.

how i can integrate paypal with my shopping cart.
Jul 6 '09 #13
hoopy
88
Have you even attempted to find out how?

There is a ton of documention at Paypal detailing this example code, etc. Also thousands of tutorials on Google.
Jul 7 '09 #14
Hi all,

I get all variable while paypal made order by mail but when i return on the page it display me thanks for the order.

Please help me how i can get all variable when i return the page on bundelkhanddarshan.com
Pramod Rawat
Sep 21 '10 #15

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

Similar topics

5
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...
4
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...
2
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...
7
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,...
5
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...
0
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...
0
by: Nicodemus | last post by:
Do You Belive? \ cheapbbc@sina.com wrote in news:aecf26b6-4c75-4d87-b09c-a7380875e0f3 @w34g2000prm.googlegroups.com:
5
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.