Search code examples
phpdatabasepasswordsmembershipverify

What is the Best Way to Validated New User after Successful Payment?


I have a member sign-up process which requires a monthly subscription payment. I have a script running which can update my member's database using an IPN script. I am curious about the best way to go about validating a new user once they have successfully submitted payment. Here is the work flow that I have envisioned for this process, but please advise if you have done something similar in a more direct fashion.

Step 1) New User completes signs up form which includes their username and password.

  • At this point I would take the the password they generated and manipulate it in the database. This way if they tried to log in they would be denied access.

Step 2) User submits credit card payment through a third party processor. Third party processor sends out IPN to update database.

  • Using the IPN script, once their payment method is validated I would set the password back to the one that they created.

Step 3) User is validated with a successful payment.

  • Since their password is back to the one they initially wanted, the user can login.

I don't see any reason this would not work, but it seems clunky. Is there a better way? Thanks.


Solution

  • Rather than not setting their password correctly, why not just have an extra field named 'paid' and default that to '0' and then if/when they pay it's set to '1'.

    Then in the login script simply make sure that field is set to '1' when they try to login.