This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

PayPal Integration YEAH!!!


  1. Trowar
    Member

    Okay, assuming you have a hidden field containing the session ID in your form (as he mentions he did above),

    You could probably just add something like this to your 'www.yoursite.com/includes/paypal.php' file below the
    $insert = mysql_query($sql);

    mysql_query("UPDATE ap_form_1 SET payment = '$payment_status' WHERE sessionid = '$custom'");

    I am assuming you are using form number 1 (ap_form_1) and that in the table ap_form_1 you have creatused a custom field called 'payment'.

    If it works, every time a payment is made it should populate the field 'payment' with 'Completed', you could then just use a query to display all orders which had been completed.

    Though if you use the above example, all paying customers are saved in the 'payments' table anyway and e-mails from paypal.php will only be sent once payment is recieved anyway so surely the above script does everything you need?

    My site is coded completely differently to the above example but that should work, if it doesn't let me know. Remember you MUST save your session id saved in you ap_form_1 table.

    Posted 14 years ago #
  2. mig2000
    Member

    Hello Trower,

    Many thanks for all of effort in helping me. At this point, I have not done or use any code as above. As you notice on my link above, I only have a simple form and the submit button which actually takes the user to pay pal . That is it. What I want to do is to take it to next level. I have never integrate anything like this before. Any suggestion that you provide me would be greatly appreciated.

    Regards,

    Alex

    Posted 14 years ago #
  3. mig2000
    Member

    Trowar,

    Should I go ahead and add the codes as the beginning of this post to my form to see if this works for me? Please advice.

    Thanks

    Posted 14 years ago #
  4. mig2000
    Member

    Trowar,

    Can you please advice?

    Thanks

    Posted 14 years ago #
  5. Trowar
    Member

    Sorry, I'm so swamped with work stuff at the moment.

    If you understand what the person is doing (yau have a knowledge of php and sql) thenf ollow the instructions.

    If you don't you would probably be better paying someone to do it for you.

    I wouldlove to help but I have some urgent matters to deal with and just don't have the time to write and post the code here. Intergrating with a paypal cart can get quite tricky.

    What's your timescale for getting this done?

    Posted 14 years ago #
  6. artitmedia
    Member

    Hello guys.
    I am as ASP developer and I want to implement paypal payment in one of my websites. All is good until the part with keeping (remembering) the form variables after the payment, as most of us struggle.
    Is anyone familiar with ASP and can collaborate with me on this matter? I will gladly share my knowledge with someone in the same situation in order to overcome the little problem we have.
    After all, 2 brains are better than one. :)

    Posted 13 years ago #
  7. mig2000
    Member

    Trowar

    Are you available now? I do not mind to pay for your time if you can get this done for me. Please let me know.

    Thanks

    Posted 13 years ago #
  8. chicagowebmanagement
    Member

    Okay, I'd like to implement this myself, but the client has OTHER forms using Machform and I don't want to negatively impact it. So, does anyone know if we can run the mods without affecting other forms, or do I need to specify this modified form to use the modified files view-functions2.php and view-functions2.php (thereby keeping the changes separate from non-paypal form).

    Any thoughts on this?

    Posted 13 years ago #
  9. drumaboy46
    Member

    Hi I'm drumaboy and I actually started this post. I have a working "complete pay intergration". You can acheive what you want by simply using this type of code.

    //'X' being your forms ID
    
    if($_GET['id'] == 'X'){
    
        //Do whatever   
    
    }

    You do not need to duplicate view-functions or post-functions...that may get real messy in the end. I hope that makes sense. I came back to the post to help everyone so please me anything.

    By the way just so everyone knows to store data from paypal after or machform submission you must use paypals IPN or their api to retrieve notifications of payments to your processing script.

    Posted 13 years ago #
  10. drumaboy46
    Member

    mig2000 this is a free forum you shouldn't have to pay anyone for a simple paypal btn. I can post step by step here its been a while but my form and paypal intergration has worked now for over a year and my clients couln't be more pleased and the one who helped me do it all was Yuniar so I'm giving back to the forum as a thank you and always will.

    Posted 13 years ago #
  11. chicagowebmanagement
    Member

    Thanks Drumaboy46! So I understand clearly, where would I place your three lines of code?

    Do I need to use your paypal.php code or no?

    I understand about IPN values, but wanted to know about being able to store the form payment receipt details in the database as well. I'd still have to add a payments table wouldn't I?

    Just looking for additional clarification, and again, THANKS!

    Posted 13 years ago #
  12. drumaboy46
    Member

    Yes this is correct chicagowebmar you can place that code anywhere you want. by that I mean whatever code you want/need to write you obvious would put it in the right place, then you wrap my code around it example. Let say you wanted php to write "I see monkeys" on your confirm page on line... lets say 85 but you only want to show it for your Zoo registration form, which is form id 16 then it would look like this.

    //obviously a stupid example but here goes: :)
    
    //get the id from url if it equals 16
    if($_GET['id'] = '16') {
           echo "I see monkeys";  //then do this.
    }

    the "id" is always present for every form you have making each forms url unique this is whats great about machform.
    example:

    ...machform/views.php?id=16

    In order for you to retrieve data from paypal (Paypal.com) yes you need to learn a little about the first post and IPN's its not to difficult. My code looks complicated and could have been cleaner I was in a rush when I did it , but read over it just to get the basic idea and any ? you have I will help.

    Yes you need to create a table the way I did it was like this.

    1. create a field in your form and hide it using CSS (to get element name simply view the source code in a browser)

    2. pre-fill that field when the form loads (viewable to user)

    3. on submit send all data to machform db as usual then redirect to paypal passing the session in the pay buy link or button (as mentioned in first post)

    4. once member has paid paypal will automatically send data to the script (as mentioned in first post) within seconds

    5. create a script to compare the id's from your machform entry and paypals entry if they match you know the paid but IF they don't match then echo "your payment has not been processed yet"; or whatever you want to say.

    Do you understand the concept?

    Just because a form is submitted and the user is redirected does not mean that they have paid you.

    (I'm not yelling but I just want to be clear so the same ?'s aren't asked multiple times.)
    PAYPAL IPN IS THE ONLY WAY TO KNOW AND ....RETRIEVE ANY AND ALL PAYMENT DATA
    FROM PAYPAL AFTER YOUR FORM HAS REDIRECTED THEM YOU CAN ONLY PASS DATA
    TO PAYPAL VIA THEIR CUSTOM URL PARAMETERS AND CAN ONLY RETRIEVE
    THAT INFO ONCE IT HAS ARRIVED IN YOUR DB.
    
    ALTHOUGH YOU CAN PLACE A REDIRECT URL IN YOUR PAYPAL ACCOUNT IT
    WILL HAVE NO SESSION DATA AVAILABLE TO YOU OR A CUSTOM URL
    WHICH YOU CAN $_GET INFO FROM

    https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro

    please let me know if you need more help....drumaboy out!

    HEY APPNITRO THIS BETTER BE A FREAKN FEATURE IN MACHFORM V3 (Now i'm yelliing lol!) there are a lot of post about this feature!

    Posted 13 years ago #
  13. chicagowebmanagement
    Member

    Drumaboy, that is perfect. Thanks! And yes, I think this would be a GREAt feature for V3!

    Posted 13 years ago #
  14. drumaboy46
    Member

    awesome let me know how that works for you :)

    Posted 13 years ago #

RSS feed for this topic

Reply