locked
session variable losing value RRS feed

  • Question

  • I'm creating a website using VB.net, a SQL server Database and a PayPal account such that I can sell a quantity of a book.

    I've created the form that the buyer fills out. When the form is submitted, the fields are saved in a database table. That same processing page, fills in a hidden form and automatically submits the quantity of books that the buyer wants to buy into the PayPal shopping cart. When the sale is complete, PayPal will redirect the buyer back to the website I'm creating. I will them mark the order in the DB table paid.

    Since another office is creating the PayPal account for me, I have not setup the cart yet. To test that this would work, I had the form processing page redirect to another page on a different domain to simulate going to PayPal. That page has a button on it to redirect back to the website I'm building so the order can be marked paid in the database.  I'm storing the order ID in a session variable.

    I tested this in a non secure environment (my dev box) and the order is marked paid. In the production secure environment, HTTPS, the session variable looses its value and the page fails to mark the order paid.

    How do I keep track of the order ID while the browser goes out to PayPal to complete the purchase? Do I open PayPal in another window, use a cookie, or pass the order ID to PayPal so that it can be passed back?

    Mike

    • Moved by Carl Cai Tuesday, October 7, 2014 1:45 AM more related to suggested forum
    Monday, October 6, 2014 8:30 PM

Answers

  • Thanks for the links but I'm not sure that I understand what you are providing. It seems like you are pointing me to code that I add to my .net project to do something, but I have no idea what to do with it.

    With some additional research, I figured out how to create an add to cart button that allows me to specify the item name, price and quantity. I added the code and now have a form that can be used to add some quantity of the book to the PayPal shopping cart. When the button is clicked new window opens containing the cart and allowing the shopper to make payment.

    Since the application is still open in the main window, the order Id session variable is not lost. I then setup PayPal to automatically return to my site upon completion of payment. This allows me to use script to mark the order in the database as paid.



    Wednesday, October 8, 2014 1:17 PM

All replies

  • This is more a question over paypal API.

    On the following links you will find samples of code and more information.

    https://devtools-paypal.com/guide/pay_paypal/dotnet?env=sandbox

    https://developer.paypal.com/docs/classic/lifecycle/code-samples/


    "If there's nothing wrong with me, maybe there's something wrong with the universe!"

    • Proposed as answer by Carl Cai Tuesday, October 7, 2014 1:43 AM
    • Marked as answer by Just Karl Tuesday, May 12, 2015 10:56 PM
    • Unmarked as answer by RCDA Webmaster_ Wednesday, May 13, 2015 1:02 PM
    Monday, October 6, 2014 8:49 PM
  • Thanks for the links but I'm not sure that I understand what you are providing. It seems like you are pointing me to code that I add to my .net project to do something, but I have no idea what to do with it.

    With some additional research, I figured out how to create an add to cart button that allows me to specify the item name, price and quantity. I added the code and now have a form that can be used to add some quantity of the book to the PayPal shopping cart. When the button is clicked new window opens containing the cart and allowing the shopper to make payment.

    Since the application is still open in the main window, the order Id session variable is not lost. I then setup PayPal to automatically return to my site upon completion of payment. This allows me to use script to mark the order in the database as paid.



    Wednesday, October 8, 2014 1:17 PM
  • Hello,

    You'd need to ask PayPal, or ask in Microsoft's ASP.Net Visual basic.net forum:

    http://forums.asp.net/36.aspx/1?Visual+Basic+NET

    As Microsoft's ASP.Net forums are on a different platform, we cannot move the question for you.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Tuesday, May 12, 2015 10:57 PM