Willkommen, Gast
Angemeldet bleiben:

THEMA:

How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8488

  • Autor
  • arc_admin
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Beiträge: 22
  • Dank erhalten: 4
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
Folgende Benutzer bedankten sich: wartime

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Letzte Änderung: Post by arc_admin.

Re:How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8492

  • Autor
  • arc_admin
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Beiträge: 22
  • Dank erhalten: 4
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
Folgende Benutzer bedankten sich: wartime

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Letzte Änderung: Post by arc_admin.

Re:How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8539

  • rewing
  • Besucher
  • Besucher
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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Letzte Änderung: Post by rewing.

Re:How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8546

  • Autor
  • arc_admin
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Beiträge: 22
  • Dank erhalten: 4
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
Folgende Benutzer bedankten sich: wartime

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Re:How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8551

  • rewing
  • Besucher
  • Besucher
Hi,Ken,

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

Would you please help me check with it?

Dateianhang:

Dateiname: mypck_001-...0908.zip
Dateigröße:2 KB
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Letzte Änderung: Post by rewing.

Re:How to Use PayPal with Classic Forms 12 Jahre 3 Monate her #8569

  • iamwaggle
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Beiträge: 2
  • Dank erhalten: 2
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
Folgende Benutzer bedankten sich: wartime

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

  • Seite:
  • 1
  • 2
Moderatoren: ForumSupport
Ladezeit der Seite: 0.056 Sekunden

Angebot

Sommer Special! Alle Mitgliedschaften zum Sonderpreis!

Prio Support, alle Extensions und alle Templates in einem Paket.

Hier geht's zur Bestellung

Crosstec hilft sparen!

Falls Sie neu bei Crosstec sind aber bereits einen Formulargenerator bei einem anderen Hersteller gekauft haben, dann bekommen sie von uns einen Rabatt von 25% auf unsere 1-Jahres und Pro-Mitgliedschaften

Wie Sie an den Rabatt kommen?

Schreiben Sie uns einfach eine kurze Email mit beigelegten Kaufbeleg (z.B. PayPal Quittung) an sales@crosstec.org.

Wir unterstützen die Joomla Community

Crosstec unterstützt weltweit alle offiziellen Joomla! User Groups und Organisatoren von Joomla! Days die bei Joomla.org registriert sind.

Falls das auf dich zutrifft und du eines unserer Produkte brauchst, schreib uns eine kurze Email an info@crosstec.org und du bekommst eine Flatrate-Mitgliedschaft geschenkt!