Paypal return

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ykhamitkar
    New Member
    • May 2007
    • 64

    Paypal return

    Hi there,

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

    Thanks,
    Yogesh
  • kovik
    Recognized Expert Top Contributor
    • Jun 2007
    • 1044

    #2
    Originally posted by ykhamitkar
    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.

    Comment

    • ykhamitkar
      New Member
      • May 2007
      • 64

      #3
      Originally posted by volectricity
      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

      Comment

      • luke14free
        New Member
        • Apr 2007
        • 79

        #4
        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...

        Comment

        • ak1dnar
          Recognized Expert Top Contributor
          • Jan 2007
          • 1584

          #5
          Originally posted by ykhamitkar
          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

          Comment

          • ykhamitkar
            New Member
            • May 2007
            • 64

            #6
            Originally posted by ajaxrand
            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

            Comment

            • ak1dnar
              Recognized Expert Top Contributor
              • Jan 2007
              • 1584

              #7
              rm is stands for Return Method

              [CODE=php]
              $paypal_return_ method="2"; //1=GET 2=POST
              <input type="hidden" name="rm" value="<?=$payp al_return_metho d?>">
              [/CODE]

              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.

              [CODE=php]<input type="hidden" name="return" value="Complete _URL_to_the Success_page.ph p">

              [/CODE]
              Here at success.php (IF rm is POST), You can print back the completed transaction details to the customer.
              [CODE=php]
              <?=$_POST['txn_id']?>
              // This is only the transaction ID
              // There are Lots like this refer to Paypal web site for more
              [/CODE]
              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
              [CODE=php]<input type="hidden" name="notify_ur l" value="complete _URL_to_IPN.php ">
              [/CODE]
              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.
              [CODE=php]<input type="hidden" name="notify_ur l" value=" http://www.site.com/ipn.php?userid= 1001">
              [/CODE]

              Thanks
              -Ajaxrand

              Comment

              • ykhamitkar
                New Member
                • May 2007
                • 64

                #8
                Originally posted by ajaxrand
                rm is stands for Return Method

                [CODE=php]
                $paypal_return_ method="2"; //1=GET 2=POST
                <input type="hidden" name="rm" value="<?=$payp al_return_metho d?>">
                [/CODE]

                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.

                [CODE=php]<input type="hidden" name="return" value="Complete _URL_to_the Success_page.ph p">

                [/CODE]
                Here at success.php (IF rm is POST), You can print back the completed transaction details to the customer.
                [CODE=php]
                <?=$_POST['txn_id']?>
                // This is only the transaction ID
                // There are Lots like this refer to Paypal web site for more
                [/CODE]
                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
                [CODE=php]<input type="hidden" name="notify_ur l" value="complete _URL_to_IPN.php ">
                [/CODE]
                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.
                [CODE=php]<input type="hidden" name="notify_ur l" value=" http://www.site.com/ipn.php?userid= 1001">
                [/CODE]

                Thanks
                -Ajaxrand

                Thank you so much Ajaxrand. Nice information

                Comment

                • ykhamitkar
                  New Member
                  • May 2007
                  • 64

                  #9
                  Originally posted by ykhamitkar
                  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
                  =============== =============== =============== ===
                  [code=html]
                  <input type="Hidden" name="cmd" value="_xclick" >
                  <input type="Hidden" name="business" value="username @hotmail.com">
                  <!-- Allow customer to enter desired quantity -->
                  <input type="Hidden" name="undefined _quantity" value="1">
                  <input type="Hidden" name="item_name " value="Registra ion">
                  <input type="Hidden" name="item_numb er" value="">
                  <!-- No currency_code variable has been specified, so monetary amount is assumed to be USD -->
                  <input type="Hidden" name="amount" value="10">
                  <! Passthrough variables for order tracking or other purpose -->
                  <input type="Hidden" name="custom" value="">
                  <input type="Hidden" name="invoice" value="">
                  <input type="Hidden" name="charset" value="">
                  <input type="Hidden" name="no_shippi ng" value="1">
                  <input type="Hidden" name="return" value="">
                  <input type="Hidden" name="cancel_re turn" value="">
                  <!-- Do not prompt customer to include a note with the purchase -->
                  <input type="Hidden" name="no_note" value="1">
                  <input type="Hidden" name="rm" value="2">
                  <input type="Hidden" name="notify_ur l" value="">
                  <input id=UserName style="WIDTH: 165px" tabindex=1 maxlength=16 name="Name">
                  <input id=PasswordVeri fy style="WIDTH: 165px" tabindex=3 type=text maxlength=15 name="Phone">
                  <input id=EMail style="WIDTH: 165px" tabindex=4 name="Email">
                  <input type=submit value=Submit Now name=Authorize onClick="update valuesonsubmit( )">
                  [/code]

                  [code=javascript]
                  <script language="JavaS cript" type="text/JavaScript">
                  function updatevaluesons ubmit()

                  notify_url = "http://mysite.com/Payment-Complete.php?";
                  notify_url = notify_url + "Name=" + frm.Name.value;
                  notify_url = notify_url + "&Phone=" + frm.Phone.value ;
                  notify_url = notify_url + "&Email=" + frm.Email.value ;
                  notify_url = notify_url + "&Country=" + frm.Country.val ue;
                  notify_url = notify_url + "&Product=" + frm.Registraion .value;
                  notify_url = notify_url + "&Amount=" + frm.amount.valu e;
                  frm.notify_url. value = notify_url;
                  </Script>
                  [/code]
                  ****

                  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:
                  [code=php]
                  <?php
                  // multiple recipients
                  $to = 'ykhamitkar@gma il.com'; //
                  $companyname = 'My comany';

                  //Put name of cc. put " $cc = '' " if not required
                  $cc = 'yogesh@teamags .com';

                  //Put name of bcc. put " $bcc = '' " if not required
                  $bcc = '';

                  // subject
                  $subject = 'Payment Complete';

                  // message
                  $mailBody = '';
                  $mailBody = $mailBody . '
                  <table border="0" bordercolor="#0 00000" rowheight="30" width="400" cellspacing="1" celpadding="1">
                  <tr>
                  <td align="center" bgcolor="#CCCCC C" colspan="2" height="30"><b>
                  <font face="Arial" size="2">Person al Details</font></b></td></tr>';

                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Name : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Name']."</td></tr>";
                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Email : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Email']."</td></tr>";

                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Phone : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Phone']."</td></tr>";

                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Produc t : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Product']."</td></tr>";

                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Amount : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Amount']."</td></tr>";

                  $mailBody = $mailBody . '<tr>
                  <td align="right" bgcolor="#CCCCC C" height="30"><fo nt face="Arial" size="2">Countr y : </td>
                  <td bgcolor="#EAEAE A"><font face="Arial" size="2">';
                  $mailBody = $mailBody . $_REQUEST['Country'].'</td></tr></table><BR><BR>' ;

                  $mailBody = $mailBody .'<font face="Arial" size="2">Thank you, <br><br>';
                  $mailBody = $mailBody .'from<b> ' . 'ABC.com' . '</b><br><br><br> </font>';


                  $headers = '';
                  // To send HTML mail, the Content-type header must be set
                  //$headers = 'MIME-Version: 1.0' . "\r\n";
                  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

                  // Additional headers
                  $headers .= 'To: ' . $companyname . '<' . $to . '>' . "\r\n";
                  $headers .= 'From: '.$_REQUEST['Name'].' <'.$_REQUEST['Email'].'>' . "\r\n";

                  if ($cc!='')
                  {
                  $headers .= 'Cc:' . trim($cc) ."\r\n";
                  }

                  if ($bcc!='')
                  {
                  $headers .= 'Bcc: ' . trim($bcc) . "\r\n";
                  }

                  // Mail it
                  mail($to, $subject, $mailBody, $headers);

                  //Open thank you page
                  //include("thank-you.htm");
                  ?>
                  [/code]
                  =============== ====


                  Please help!!

                  Thanks,
                  Yogesh

                  PLEASE USE [CODE] Tags - Ajaxrand

                  Comment

                  • ak1dnar
                    Recognized Expert Top Contributor
                    • Jan 2007
                    • 1584

                    #10
                    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.

                    Comment

                    • ykhamitkar
                      New Member
                      • May 2007
                      • 64

                      #11
                      Originally posted by ajaxrand
                      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.

                      ======

                      Hi Ajaxrand,

                      I tried the notify url and it works well.

                      Thanks for your help

                      Yogesh

                      Comment

                      • ak1dnar
                        Recognized Expert Top Contributor
                        • Jan 2007
                        • 1584

                        #12
                        Originally posted by ykhamitkar
                        ======

                        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

                        Comment

                        • jawwad90020021
                          New Member
                          • Jul 2009
                          • 13

                          #13
                          Help in paypal direct method in php apis

                          please help me to integrate the paypal direct method.

                          how i can integrate paypal with my shopping cart.

                          Comment

                          • hoopy
                            New Member
                            • Feb 2009
                            • 88

                            #14
                            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.

                            Comment

                            • rawat167
                              New Member
                              • Sep 2008
                              • 1

                              #15
                              How to return Paypal variable

                              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 bundelkhanddars han.com
                              Pramod Rawat
                              Last edited by Atli; Sep 21 '10, 04:40 PM.

                              Comment

                              Working...