Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#5143 by MuraliGK
28 Nov 2017, 17:57
Hi Everyone,

I'm new to aimeos, and I'm using aimeos laravel package as the backend. I'm developing the frontend using react native, so that I can use it for both web and mobile.

My payment gateway is javascript based, once the payment gateway returns the status, i need to update the payment status in aimeos using an API. I have gone through the API documentation but couldn't find a way to update the payment status.

My environment: Laravel 5.5, PHP 7.1.5, Aimeos 2017.10

Kindly let me know how to proceed further.

Thanks in Advance.
#5153 by aimeos
28 Nov 2017, 22:38
The JSON REST API doesn't currently have an endpoint for updating the order payment status. The main problem is: How can you update the payment status in a secure way without enabling attackers to update the status to any value theirselves?
#5167 by aimeos
30 Nov 2017, 10:14
The best and most secure way to update the payment status in your setup is to pass the notification (update) URL to the payment gateway and use the returned payment status only for displaying it to the customer. The payment gateway will send a "server to server" notification with the payment status at the same time and will update the status value in the database.
#5175 by MuraliGK
01 Dec 2017, 07:01
Thanks for your suggestion. I have checked the database tables, "mshop_order" is the table having the info about the payment status, is it enough to update this table or I need to update any other tables as well. Is there any predefined class / method available to update the payment status.
#5181 by aimeos
01 Dec 2017, 10:44
You should always use the order controller to update the order items:

Code: Select all$cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' );
$item = $cntl->getItem( $id, false );
$item->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED );
$cntl->saveItem( $item );