So lets say I want to make a script that adds credits into a database when customer pays money using some gateway like paypal.

What if there comes an error while updating the database row? For example the conection is lost. Then I could do some logging to a text file that there was an error. And write some script that reads from log file and corrects the errors - updates the database entries according to log file.

But yet - it is even possible that for some reason the log to a text file will fail, but extremely unlikely so probalbly we can ignore it.

Is there a better way for this? How pro's do that? I am new to things like this, and don't know where to read how to code such things.

hmm, I have no experience with payment gateways, but with paypal maybe it is easy undo the payment. So it means paypal should return money to the customer.

But what about with such like https://www.webtopay.com/ - he does not hold his money in that site like in paypal. This is popular in our country. In this customers can pay from their bank accouts or by phone so I don't think its that easy, if possible at all to return money. So I think once the customer payed his moeny, it would be best to convert his money into credits. Just the question - how to be 100% sure that money will be converted.

Oh, now remembered on thing - the payment procesor requires to send a query string that my site has received information about payment. So I may not send info that my site received money if the database update is not succesfull, then payment processor probably will return money to the custommer.

Ok, thanks, maybe later I will study more about this, now I have to do basic things, so I do them just simulating payments.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.