Paypal within Chronoforms Help

Barry The Penguin 03 Dec, 2007
Hello,

I'm helping develop a site for a local camp and we've decided to allow people to register and pay using paypal.

We are using ChronoForms for the registration part and I found out a paypal button can also be created the same way, http://tinyurl.com/2nrpy7.

We have the registration working, but the paypal is the hard part. The paypal solution above, I feel, isn't complete. If someone could give a hand on how to create the following code into a button it would be appreciated.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="paypal@example.com">
<input type="hidden" name="item_name" value="Deposit Payment - dcypher '08">
<input type="hidden" name="item_number" value="$20 dcypher '08 deposit">
<input type="hidden" name="amount" value="21.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
I realise the form code isn't used in ChronoForms but it is necessary for the button to work.

Thank you.
GreyHead 04 Dec, 2007
Hi Barry,

This code looks fine to me, it's identical to the code you get from PayPal's Buy Now button tool.

You should just be able to put this into a Joomla content page.

What seems to be the problem?

Bob
Barry The Penguin 04 Dec, 2007
I've tried that.

But when you update the HTML code it only puts in the line
<img src='https://www.paypal.com/en_AU/i/scr/pixel.gif' border='0' alt='' width='1'; height='1' />

Which, as it says, is just a pixel.

Am I including the paypal code in the wrong section?
GreyHead 04 Dec, 2007
Hi Barry,

I'm sorry I think I misunderstood. If you want to use this from ChronoForms then put the code - without the <form> tags into the html code box and then put https://www.paypal.com/cgi-bin/websc in the Form URLs | Submit URL box.

That works OK for me, clicking the button takes me to PayPal.

Bob
cliffclof 23 May, 2008
Thank you. This worked very well. It saves my form data and forwards me to paypal. Great help. I am trying to allow for verification of payment as well. Has anyone done this? I'm going to work on it. I think something like this may work.

{if isset($smarty.get.st) && $smarty.get.st == 'Completed'}
   Thank you very much, your order will be processed within the next one to two business days
{else}
   Was there a problem with your transaction?
{/if}

Again any ideas would help. Thanks.
Max_admin 24 May, 2008
Hi cliffclof,

I need to understand, whats $smarty.get.st variable ? and to which page Paypal returns you after payment ? I know they send back some variable but I'm not aware to which url and what are their names or values!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 25 May, 2008
Hi cliffclof,

I'd be inclined to set the PayPal Return URL to come back to the same ChronoForms URL (or maybe a second form) but to include a GET variable to identify it. You can pick up the GET variable, pull the form data from the database and process the results.

Bob
cliffclof 30 May, 2008
Thank you that sounds like a good plan. I'm new to paypal and have only setup basic forms in chronoforms, but I got it to work. Only thing is in the short amount of time i have not been able to setup a verification of payment. I'll try what you suggested.

For now what I did was use a standard paypal form with the action and _xclick removed.

I then added the on submit after email by typing in the long paypal code with _xclick and other variables needed to complete a paypal process.


If i get it worked out in the next few weeks I'll try to post back here on what i did to get the verification going. Thanks for the help
GreyHead 30 May, 2008
Hi cliccclof,

Good, thanks. I have a PlugIn for PayPal half-complete. When I have some time I'll get it finished off properly.

Bob
krisnahari 17 Aug, 2008

Thank you. This worked very well. It saves my form data and forwards me to paypal. Great help. I am trying to allow for verification of payment as well. Has anyone done this? I'm going to work on it. I think something like this may work.

{if isset($smarty.get.st) && $smarty.get.st == 'Completed'}
   Thank you very much, your order will be processed within the next one to two business days
{else}
   Was there a problem with your transaction?
{/if}

Again any ideas would help. Thanks.




Hi cliff,
i wanted to do the same form like you, how do you manage to make chronoform to save the form data?
mine just take me to paypal. I can't see my form data being saved on the backend.

Grayhead, sir, here's my form code. can you examine these please?

<table width="300" border="0" cellspacing="2" cellpadding="0">
  <tr>
    <td width="84"><div align="right">name</div></td>
    <td width="12">:</td>
    <td width="196"><input type="text" name="name" id="name"></td>
  </tr>
  <tr>
    <td><div align="right">Address</div></td>
    <td>:</td>
    <td><input type="text" name="address" id="address"></td>
  </tr>
  <tr>
    <td><div align="right">phone</div></td>
    <td>:</td>
    <td><input type="text" name="phone" id="phone"></td>
  </tr>
  <tr>
    <td><div align="right">dietary needs</div></td>
    <td>:</td>
    <td><input type="text" name="dietary" id="dietary"></td>
  </tr>
  <tr>
    <td><div align="right">etc 01</div></td>
    <td>:</td>
    <td><input type="text" name="etc01" id="etc01"></td>
  </tr>
  <tr>
    <td><div align="right">etc 02</div></td>
    <td>:</td>
    <td><input type="text" name="etc02" id="etc02"></td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td><input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="mercha_1218966001_biz@gmail.com">
<input type="hidden" name="item_name" value="Intensify Conference Registration">
<input type="hidden" name="amount" value="250.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="ID">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</td>
  </tr>
</table>


I've created some text field as form data which i need to save to chronoform database.
and i make a paypal button as submit.

thanks in advance.
GreyHead 17 Aug, 2008
Hi krisnahari,

I'm not clear where you are redirecting to PayPal now. The simplest way to get your data saved is to build a ReDirect URL in either the one of the OnSubmit boxes or the AutoGenerated code box. The code looks like this:
/**
 * Build PayPal URL & redirect
 */
// Note business and base_url for testing only
    $url  = $ww_config['paypal_url'];
    $url .= "&business=".$ww_config['paypal_business'];
    $url .= "&item_name=Site_Subscription";
    $url .= "&item_number=1001";
    $url .= "¤cy_code=GBP";
    $url .= "&amount=$fee";
    $url .= "&custom=$userid";
    $url .= "&return=".$ww_config['paypal_return'];
    //$url .= "&return=".urlencode($ww_config['paypal_return']);
    // $url .= "&cancel_return=".$ww_config['paypal_cancel_return'];
    $url .= "&no_note=1";
    $url .= "&no_shipping=1";

if ( $debug ) {
    echo "url: ";print_r($url);echo "<br />";
    echo "<a href='$url'>Click to continue</a>";
} else {
    $rows[0]->redirecturl = $url;
}
- the $ww_config['field_name'] entries come from a configuration block and contain the various PayPal parameters.

Bob

PS If you use ReDirect URL you must be sure that you have the bug-free version of chronocontact.php posted at various places in the forums here.
krisnahari 17 Aug, 2008
^
I'm redirecting to PayPal sandbox, so i can try before implementing the real site.
Ups, i'm mean i'm using Submit URL to: https://www.sandbox.paypal.com/cgi-bin/websc - NOT redirecting.

Ok I will try to digest your suggestion since i'm not PHP savvy. 😶

btw, I have found the bug-free chronocontact.php and overwrite the old one.
GreyHead 17 Aug, 2008
Hi krisnahari,

If you use the OnSubmit URL then control is passed directly to PayPal, ChronoForms never sees the form submission results and will not be able to save your data.

Either route works OK but the results are different.

Bob
krisnahari 17 Aug, 2008
yes, i figured that much.
If i use submit URL: I can get to paypal payment process along with the informations from paypal buy now button BUT form data's not saved in chronoform
If i use redirect URL: I can get chronoform save the data but no payment process to paypal

So, i need to build a redirect URL in either the one of the OnSubmit boxes or the AutoGenerated code box using the code you've provided earlier.
This is where I lost you completely: didn't the AutoGenerated code box already filled with script to add form data to database? So i guess i'll use your code in the OnSubmit box then.

ps. thanks for putting up with me, i'm such a n00b😛
GreyHead 17 Aug, 2008
Hi krisnahari,

The Autogenerated box does have code in it, but it isn't *full* - you can put the extra code at the end.

Bob
krisnahari 17 Aug, 2008
Yes, getting there! 😛
Btw i've noticed that there are a few thread regarding PayPal integration. I'm sorry if i brought up old topics.

i need to adjust the variables so the form will get processed by PayPal.
i hope i get those correctly.

+ redirectURL: https://www.sandbox.paypal.com/cgi-bin/websc = data saved and redirected to PayPal BUT still no payment process, just a login to PayPal.
GreyHead 17 Aug, 2008
Hi krisnahari,

I've miseld you by posting some code without cleaning it up fully:
    /**
    * Build PayPal URL & redirect
    */
    // Note business and base_url for testing only
        $url  = "https://www.sandbox.paypal.com/cgi-bin/webscr";
        $url .= "&business=merchant@paypalmerchants.com";
        $url .= "&item_name=Conference Registration";
        $url .= "&item_number=1001";
        $url .= "¤cy_code=USD";
        $url .= "&no_note=1";
        $url .= "&no_shipping=1";
        $url .= "&amount=$fee"; // insert the variable with the amount in it
        $url .= "&custom=$userid"; // add something that will lwt you identify the transaction.
        $url .= "&return= ""; // insert the URL you want PayPal to come back to after payment is made
    // $url .= "&return=".urlencode($ww_config['paypal_return']);
    // $url .= "&cancel_return=".$ww_config['paypal_cancel_return'];

    if ( $debug ) {
        echo "url: ";print_r($url);echo "<br />";
        echo "<a href='$url'>Click to continue</a>";
    } else {
        $rows[0]->redirecturl = $url;
    }

Bob
krisnahari 18 Aug, 2008
Hi Bob!
Now the form WORKS! Data saved and redirected to PayPal with transaction.

For anyone else who needs similar feature, place this inside your AutoGenerate box along with the rest of the codes there:

// Get user-information from Joomla
$user = &JFactory::getUser();
        /**
        * Build PayPal URL & redirect
        */
        // Note business and base_url for testing only
            $url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; //change this to the real paypal server
	    $url .= "&cmd=_xclick";	
            $url .= "&business=your_merchant_email@test.com";
            $url .= "&item_name=item_name";
            $url .= "&item_number=item_number";
            $url .= "¤cy_code=currency"; //eg. USD
            $url .= "&no_note=1";
            $url .= "&no_shipping=1"; // 0 if you need shipping
            $url .= "&amount=amount"; //enter number like 10 for $10 
            $url .= "&custom=$user->id"; 
            $url .= "&return=urlencode (return url)"; 
        // $url .= "&return=".urlencode($ww_config['paypal_return']);
        // $url .= "&cancel_return=".$ww_config['paypal_cancel_return'];

        if ( $debug ) {
            echo "url: ";print_r($url);echo "<br />";
            echo "<a href='$url'>Click to continue</a>";
        } else {
            $rows[0]->redirecturl = $url;
        }
?>


Now i need to figure out auto responder email. I'm reading another thread about this.
Chronoform ROCKS! Will get the licensed version, definitely!
krisnahari 18 Aug, 2008
Btw, looking forward for your paypal plugins...😀

is it possible we can have an auto-responder to sent email after the payment completed?
that would be wonderful!
Max_admin 18 Aug, 2008
Hi Kris,

you will need to send paypal back to another Chronoform and get the email of the buyer and use the email function to send the email in the form body!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
krisnahari 19 Aug, 2008
Hi Admin,

Can you provide a more detailed step by step how to do this? I'll try googling down myself meanwhile😶
i'm guessing IPN?
GreyHead 19 Aug, 2008
Hi krisnahari,

The simple way to do this is to put the user's email into the PayPal Return URL, then pick it up from the GET variables when the reply is received. Of course it's not very good practice to send emails like this.

The more complictaed way is to save the transaction info into a database table, include a unique identifier in the PayPal Return URL and use this to look up the record in the database. This gives you pretty much full control over managing the reply.

Bob
This topic is locked and no more replies can be posted.