OOP PHP code for managing return variables from payment gateway back to shop

Hello,

I am new to OOP in PHP5. I could do that in a few lines in PHP procedural code, but in OOP being a begginner, I’m a bit lost. Maybe I can get some help here from you.

I have, say, a shopping cart and the user clicks the Buy button, he goes to the payment gateway page(on the site of the payment provider), fills in the card details and then clicks the Pay button which brings him back to a page from the site he bought the products from - let’s say transaction_results.php . Btw, the site is made with WP and so, the php code present in a WP page must have some improvements to be parsed, some plugins must be installed for that; so I’d rather do that in a class and functions rather than add code directly in a WP page.

The payment gateway returns some variables, the most important is the transaction status which is int format; for eg if transaction_status is 8 -> payment authorized, if 2 -> payment denied etc These vars are sent for the moment through $_GET, but they could be sent also as $_POST. How can I sum up all these in a function and then analyze the variables in order to update the database with the order status?

I have some samples from the shop but they seem like I don’t know where the functions come from and I’m not sure they fit for what I need. Any help please??