Problems with data copying to checkout

Discussion in 'eCommerce' started by Viggenmort, Aug 2, 2010.

  1. #1
    Hi,
    Was split between this section and the web design help one, but as its cart oriented i went for this one.

    At present i have a simple form which will submit fields/values to one of my database tables. i.e. user enters details such as name, location, email and the submit button copies that into a user database table.

    What i want to do is add a paypal (or other checkout) in there.
    Basically it needs to have a checkout button instead of submit.
    Users enter details 'all' values are copied to the checkout screen and are only added to the database when they have completed payment.

    Data entered - checkout page - data added to DB after payment.

    The problem i'm having is with paypal's checkout being hosted via them i can't edit the page to carry over the field values i.e. $Name = $_POST['Name'];

    I currently have the post form triggering the checkout and the checkout completion triggering the update to DB script, but the values are lost on the checkout page.

    I hope this makes sense to someone.
    Regards
    Matt
     
    Viggenmort, Aug 2, 2010 IP
  2. Bagi Zoltán

    Bagi Zoltán Well-Known Member

    Messages:
    364
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Hi Matt,

    I guess I understand the problem. I think you will have to store the user typed data, and the order details in a temporary tables, and when PayPayl verify the successful transaction via IPN you populate the user data to your real customer, and order table according to the order id.

    Best wishes,
    Zoli
     
    Bagi Zoltán, Aug 5, 2010 IP
  3. bigmax

    bigmax Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah, IPN is the key here. Make sure you've correctly setup the IPN pointing page in your PayPal's account settings, and that the code on your side is well-equipped to accept and/or process the checkout info. Basically along the lines of

    
             fputs($fp, "POST $url_parsed[path] HTTP/1.1\r\n"); 
             fputs($fp, "Host: $url_parsed[host]\r\n"); 
             fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); 
             fputs($fp, "Content-length: ".strlen($post_string)."\r\n"); 
             fputs($fp, "Connection: close\r\n\r\n"); 
             fputs($fp, $post_string . "\r\n\r\n"); 
    
    Code (markup):
    where $post_string is your whole order's array info (customer's particulars (email address), product description, price and whichever other fields you fancy adding).
     
    bigmax, Aug 10, 2010 IP