views:

185

answers:

1

I am trying to design a web application(using php and mysql) in which I will ask my clients to pay via paypal subscription, which detects money from the clients paypal account automatically and transfers it to my paypal account.

Now when a client logs into my web application after 3 months of time, is there a way my web application to know if a payment has been made from the clients account to my merchant account in the last 30 days.

Any suggestions please

A: 

I think you must set up a table like this:

id | user_id | order_id | payment_method | payment_received
-----------------------------------------------------------
1  | 8       | 7        | paypal         | 2009-12-12 16:03
2  | 6       | 9        | paypal         | 2010-02-01 12:03

If the customer has payed his order, you will insert a record in this table. You can check the last payments for your customer with this query:

SELECT COUNT(*) FROM payments 
WHERE (payment_received + INTERVAL 30 DAY) >= NOW()
AND user_id = xx

If the result is bigger than 0, you know that there was a transaction in the last 30 days between you and your customer

Bas van Dorst
that is ok, but how will I update the table or otherwise how will my web application know a payment has been made/failed 3 months later to update the table in my database
Ramji