Trying to create an extension where I need to redirect the user (merchant) to a third party payment website where he will log in and give authorization (OAuth 2.0) to handle payments. Once he does that, he will be redirected to the REDIRECT_URI I supplied.
Currently, I'm supplying REDIRECT_URI with my extension edit page url followed by his current user_token.. something like this:
https://mydomain.com/admin/index.php?ro ... 6Def789Ghi
The third party payment website appends an authorization code to my REDIRECT_URI, making it something like:
https://mydomain.com/admin/index.php?ro ... =123456789
(Note the '?' before authorization code).
Here is the problem:
When the new formed URL is loaded, it asks the user for Login again because user_token is '123Abc456Def789Ghi?authorization_code=123456789' (?auth.. is appended to user token).
I was able to fix it by editing the admin/controller/common/header.php file and 'fixing' the query parameters. All is working fine buuuut... Since I want this to be an extension, I need to find another way of doing this that doesn't require me to edit anything outside of my extension files.
Since it uses OAuth 2.0 I'm pretty sure someone has already came up with this problem and was hoping they could tell me how they solved it
However, there are plenty of examples that can be seen regarding callback methods in your catalog/controller/extension/payment folder. However, since your extension is about handling payments, it is best practice to create a local API with the api token rather than the user token in this case since Opencart can already handle all payments, shipping and order totals via the already implemented API solutions these days. Also considering event files would also be ideal to achieve this.
Based on the provided analogy for editing the admin header controller, this strategy is not needed in order to gather results via APIs anymore compared to prior OC versions.
You can also see API examples from your catalog/controller/api folder.
The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.
Users browsing this forum: No registered users and 7 guests