Welcome, Guest

How to Use PayPal with Classic Forms
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: How to Use PayPal with Classic Forms

How to Use PayPal with Classic Forms 2 years, 8 months ago #8488

First, many thanks to user 'glwright' who helped me figure this out.

Here is working code with only the site domain obfuscated. Note that PayPal has a 'sandbox' mode for testing plus the live site to accept real payments. There are two 'return' links. One returns to my 'Thank You' page which triggers an email to be sent. If the customer clicks cancel while at the PayPal site they return to the &cancel_return URL where you can tell tell them their transaction was not completed.

On the PayPal site you must do the following:
1) Set up a payment button, but you do not need the code from there. All you need is the generated button ID to include in the code below
2) In your PayPal Profile/Web Site Payments Preferences: set Auto Return ON

And in your form's Begin Submit piece include the following code:

// ----  Paypal Processing  ---------------------------------------------
$business = "OnlinePayments@mydomain.org" ;   // email addr for your PayPal merchant acct
$rurlraw  = "http://mydomain.org/index.php?option=com_facileforms" .
            "&ff_name=arcRNEW12&ff_page=1&Itemid=142" ;  // raw URL for return
$rurl     = urlencode($rurlraw) ;                        // url encoded
$canurl    = "http://mydomain.org/index.php?option=com_facileforms" .
             "&ff_name=arcRNEW13&ff_page=1&Itemid=143" ;  // raw URL for cancel
$cancelurl = urlencode($canurl) ;                         // url encoded
$PPURL = 'https://www.paypal.com/cgi-bin/webscr?' ;
$button = '1234567' ;   // PayPal Button ID

//  Adjust if Test Site
if ($site == "Test") {
$business = "ken_1234567890_biz@mydomain.org" ;
$rurlraw  = "http://mydomain.org/test/index.php?option=com_facileforms" .
            "&ff_name=arcRNEW12&ff_page=1&Itemid=142" ;  // raw URL for return
$rurl     = urlencode($rurlraw) ;                        // url encoded
$canurl    = "http://mydomain.org/test/index.php?option=com_facileforms" .
             "&ff_name=arcRNEW13&ff_page=1&Itemid=143" ;  // raw URL for cancel
$cancelurl = urlencode($canurl) ;                         // url encoded
$button = '9876543' ;   // PayPal Button ID
$PPURL = 'https://www.sandbox.paypal.com/cgi-bin/webscr?' ;
}  //  site = "Test"

$item_name = "Club Membership Renewal" ;
$amount    = $AMTPAID ;
$logo      = "http://mydomain.org/images/site_logo.gif" ;
$retmsg    = "RETURN TO Our Club to COMPLETE YOUR RENEWAL" ;

$data  = "cmd=_xclick&business=$business&item_name=$item_name&item_number=1" .
         "&amount=$amount&no_shipping=1&cancel_return=$cancelurl" .
         "&no_note=1&currency_code=USD&lc=US&cpp_header_image=$logo" .
         "&address1=$ADDRESS&city=$CITY&state=$ST&zip=$ZIP" .
         "&first_name=$FIRSTNAME&last_name=$LASTNAME" .
         "&return=$rurl&cbt=$retmsg&custom=$Badge&rm=2" .
         "&hosted_button_id=$button" ;

$url = $PPURL . $data ;
ff_redirect("$url","top","post") ;

//  That's it -----  You do not return to here; 
//  but to one of the above return URLs
  • arc_admin
  • OFFLINE
  • Junior Boarder
  • Posts: 23
  • Karma: 0
Last Edit: 2 years, 8 months ago by arc_admin.

Re:How to Use PayPal with Classic Forms 2 years, 8 months ago #8492

Just one note: I notice the forum software stripped the
"http://"
from all of the URLs I posted in the above code, but all of the URLs do require this specification.

Never mind - corrected by displaying as code.

Ken
  • arc_admin
  • OFFLINE
  • Junior Boarder
  • Posts: 23
  • Karma: 0
Last Edit: 2 years, 8 months ago by arc_admin.

Re:How to Use PayPal with Classic Forms 2 years, 8 months ago #8539

I don't know why I get an error with the above instruntion:

Fatal error: Call to undefined function ff_redirect() in /home4/mydomain/public_html/components/com_facileforms/facileforms.process.php(1049) : eval()'d code on line 27

Another thing is how to get the field value that user input? ff_getSubmit?

if you can export a full working example package and attached in the thread, this would be great help. Because people can modified from a working example.

I would appreciate if you could help me with it. my email is rewing#howfortune.com
  • rewing
Last Edit: 2 years, 8 months ago by .

Re:How to Use PayPal with Classic Forms 2 years, 8 months ago #8546

The first line of any of your piece code when working with Breezing Forms should generally be:
$this->execPieceByName('ff_InitLib');

This defines all of the BF functions and should make your php error go away.

Yes, you get user input from your defined fields on form pages using:
$func = ff_getSubmit('arcHiddenFunc',   0);

In my example I am retrieving the value of a field named 'arcHiddenFunc'. If that field is null then 0 will be returned.

Happy coding!
Ken
  • arc_admin
  • OFFLINE
  • Junior Boarder
  • Posts: 23
  • Karma: 0

Re:How to Use PayPal with Classic Forms 2 years, 8 months ago #8551

Hi,Ken,

Thanks! But I don't know why my test form can't work.

Would you please help me check with it?

File Attachment:

File Name: mypck_001-20090908.zip
File Size: 1894
  • rewing
Last Edit: 2 years, 8 months ago by .

Re:How to Use PayPal with Classic Forms 2 years, 8 months ago #8569

Hi Ken!

Nicely done! I've got everything working per your example.

I want to use this script in the After Submit area so I can capture the user's form data. Is there any way to get the Paypal transaction id back from Paypal and into the database like Easy Mode does it?

I've been working on it for a while but I can't seem to figure it out. My only other thought is to have the return URL send the user to another form and take the "tx" from the address bar REQUEST and plunk it into the form as a hidden field. I'm just wondering if you have any thoughts on this. Making Paypal available in the Classic Form is definitely needed. This is the only function holding me back from pure bliss.

Thanks for your help!
Justin
  • iamwaggle
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
  • Page:
  • 1
  • 2
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.41 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint