Payment Gateway Notify URL

Hi All,

I am busy implementing my Payment Gateway and was wondering who else have got it right using Yii2.

The major problem seems to be the Notify URL. I use a URL similar to index.php?r=company/processpayment

Inside the Company controller, I will have an action method called actionProcesspayment and in it will reference a model and update the DB tables.

The problem is, no matter what I do, I cannot seem to get it to work.

First problem was "Unable to verify your data submission". I got rid of that by setting the enableCsrfValidation = false

Now it seems as if no matter what I do, I get "Setting unknown property". As if the model I am referencing does not know of all the properties.

This only happens on the return URL which is automatically called from the payment gateway supplier. Once I am back on my site and click on other links, everything works 100%.

I don’t know what is going on, can someone please try and help?

Am I doing something wrong here?

Should I be using a url to a standard php file and not a Yii2 based controller/action url?

For now the only way I could get it to work is to use this in the notify url controller action:




Yii::$app->db->createCommand("my sql command")->execute();



I will use this but if there is another way to do this, please let me know.

Code and break seem to be the order of the day.

I now have this:




$companymodel = Yii::$app->db->createCommand('SELECT * FROM company WHERE id=1')->queryOne();



Above works 100% but then right after that I do this:




Yii::error($companymodel); // Prints complete DB record with all values in log file.

Yii::error($companymodel->id); //Prints null.



This works:




$companymodel = Yii::$app->db->createCommand('SELECT * FROM company WHERE id=1')->queryOne();


Yii::error($companymodel); // Prints complete DB record with all values in log file.

Yii::error($companymodel['id']); //Prints the company id