tags:

views:

283

answers:

1

I've got a web application with a form where users can sign up for a seminar. The process is currently as follows:

  1. Register for seminar
  2. Registration success page with Paypal Buy-Now button to make payment
  3. Paypal payment
  4. Registration completion page

At present, emails are sent to the admin and the user at step 2 after registering confirming their registration. This needs to be changed so that the emails are actually sent in step 4, after payment has been made.

The application is built in ASP.NET, and all of the code to send emails, etc is all done. I'm curious as to what is the best way to trigger a process on the main website using the users details after they have completed the Paypal payment process.

From what I can see, there are the following options:

  1. Store the data in the session. When the user returns to the registration completion page, retrieve the information and send the emails. My concern with this is that I've worked on a project in the past implementing this and it never worked very well, with the session getting lost.

  2. Store the data in the database. Have the Paypal redirect include the transaction details in the querystring to the return page, which can retrieve the registration details using the email address and send the emails. However, this may not work if the email address used on Paypal is different from the one used to register (which is quite likely in this scenario).

  3. Post all the details to Paypal, so that they are included in the transaction. Downsides: Won't send confirmation email to the user, only the admin (and assuming that the Paypal email address is the same as the email to which payment notifications should be sent). Also not sure if this can be used with hosted buttons.

I'm sure this is a common problem, and any advice would be appreciated. Thanks.

A: 

Use paypal instant payment notification

When the order is placed on your site, put it into a db table, with whatever you need to record. I then have an OrderId (from the db table) that I pass to paypal as an 'invoice' field, this gets passed back via ipn with a payment status etc.

Bedwyr Humphreys
Thanks. Also came to the same conclusion after reading through the Paypal documentation a bit more. Haven't implemented it yet, but it seems like it's the best way to solve this issue.
Mun
I found it a right pain to debug using the ipn test tool. You might want to mock your own implementation.
Bedwyr Humphreys