Forums

Creating forms with PayPal code

TiaKari 01 Mar, 2009
I have a similar issue, and forgive me if I should've posted a New topic to ask but my question may actually help the original poster too...

I got past the "posting to paypal but no email" issue thanks to this forum...

and i'm trying to do the onsubmit to send to paypal after the email... my button code is saved at paypal so i only have two hidden fields for paypal added to the form..
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="9999999">


how would i pass that on to paypal in the php code provided in the forum, would i just pass the hidden fields in the same manner, replacing all the variables in the original code?

like this?

<?php
    /**
    * Build PayPal URL & redirect
    */

    // Variables are set in the $form_config array
    $url  = $form_config['https://www.paypal.com/cgi-bin/webscr'];
    $url .= "&cmd=_s-xclick";
    $url .= "&hosted_button_id=9999999";
}
 if ( $debug ) {
        echo "url: ";print_r($url);echo "<br />";
        echo "<br /><a href='$url'>Click to continue</a><br />";
    } else {
        $rows[0]->redirecturl = $url;
    }
    ?>


If that's correct then i think that the original poster (sorry, i think it's Ron but i've read so many post that i cant remember the name now that i'm in the reply form) can do the same thing with paypal's long encrypted string, just pass it as a variable, which is what would happen on a website that wasnt using chronoForm. (might be wrong but it's worth a try)

Thank you
tamara
TiaKari 01 Mar, 2009
impatience is a virtue...

I tested my theory with the above code and it kinda almost works...
it passed the hidden fields to the url
BUT
it uses MY site as the base url and attaches the paypal code to the end of it,
mysite.com?cmd=_s-xclick&hosted_button_id=999999
instead of the paypal url in the php code...
paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=999999

i didnt change anything in the code other than the cmd and hidden field variables, so my new question is what do i need to change to get it to redirect to correctly to paypal..

(i'm gonna keep fiddling with it, i may figure it out)
Max_admin 02 Mar, 2009
Hi,

Whats you should have:
 $url  = 'https://www.paypal.com/cgi-bin/webscr';


and it should work fine, I will release a new PayPal plugin which will work behind the scenes and without getting redirected to PayPal, it uses PayPal API and need SSL at your site!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
TiaKari 03 Mar, 2009
it works great..

I have a few other sites that i'm doing for various friends' businesses and was killing myself trying to do PDF's and redirect to PayPal, now that i've found Chronoform, My life is gonna be a little easier. I'll be purchasing a license on the commercial site i have next in line.

thanks a lot guys
This topic is locked and no more replies can be posted.