Aimeos manual order creation (webhook Stripe)
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Aimeos manual order creation (webhook Stripe)
Hi all,
I'm using Aimeos for single products and subscriptions. So far, everything is working pretty fine. The last step to finalize the platform is to receive a webhook from Stripe when the subscription auto-renews.
When a subscription renews, I would like to add an order in the same way a normal order is placed via the backend. In other words, I want the order to appear in the order history of the client, I want the order to appear in my list of order to handle etc...
Someone has experience with this? Or someone can advise me on the best way to set this up?
I can directly input the database, but that would not be so clean. So I assume there are better options to build this.
Thanks for advising me on this one.
Regards,
Kevin
I'm using Aimeos for single products and subscriptions. So far, everything is working pretty fine. The last step to finalize the platform is to receive a webhook from Stripe when the subscription auto-renews.
When a subscription renews, I would like to add an order in the same way a normal order is placed via the backend. In other words, I want the order to appear in the order history of the client, I want the order to appear in my list of order to handle etc...
Someone has experience with this? Or someone can advise me on the best way to set this up?
I can directly input the database, but that would not be so clean. So I assume there are better options to build this.
Thanks for advising me on this one.
Regards,
Kevin
Re: Aimeos manual order creation (webhook Stripe)
You only have to create an additional record in the mshop_order table, best using the order manager:
You only need the Aimeos context for this.
Code: Select all
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
$invoice = $manager->createItem();
$invoice->setBaseId( '<ID of mshop_order_base table with the related order>' );
$invoice->setType( \Aimeos\MShop\Order\Item\Base::TYPE_REPEAT );
$invoice->setDatePayment( date( 'Y-m-d H:i:s' ) );
$invoice->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED );
$manager->saveItem( $invoice );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Aimeos manual order creation (webhook Stripe)
Thank you for the feedback. Looking at your code I assume you attach an order to an already existing base item. That could work for me. But how do I use the code you provide into a standard Laravel controller?
I defined context like:
But I receive following error "Locale object not available"...
Can you guide me on this please?
K.
I defined context like:
Code: Select all
$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
Can you guide me on this please?
K.
Re: Aimeos manual order creation (webhook Stripe)
Hi Kevin!
Could you tell me how do you use Stripe subscriptions? Are you use ai-payments for this? Will you create a new order type at db and at Aimeos for subscriptions?
Could you tell me how do you use Stripe subscriptions? Are you use ai-payments for this? Will you create a new order type at db and at Aimeos for subscriptions?
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5
Re: Aimeos manual order creation (webhook Stripe)
If you use false for the get() method, no locale object is added. Using no parameter will add the locale object:Kevin wrote: I defined context like:But I receive following error "Locale object not available"...Code: Select all
$context = app( '\Aimeos\Shop\Base\Context' )->get( false );
https://aimeos.org/docs/Laravel/Extend_Aimeos
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Aimeos manual order creation (webhook Stripe)
Hi!
Everything is working fine, except the mailing is send in English... Not in the language defined in the base item. How can I use the language that was defined in the base?
Everything is working fine, except the mailing is send in English... Not in the language defined in the base item. How can I use the language that was defined in the base?
Code: Select all
$context = app( '\Aimeos\Shop\Base\Context' )->get( );
$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
$invoice = $manager->createItem();
$invoice->setBaseId(101);
$invoice->setType( \Aimeos\MShop\Order\Item\Base::TYPE_REPEAT );
$invoice->setDatePayment( date( 'Y-m-d H:i:s' ) );
$invoice->setPaymentStatus( \Aimeos\MShop\Order\Item\Base::PAY_RECEIVED );
$invoice->setDeliveryStatus(\Aimeos\MShop\Order\Item\Base::STAT_PROGRESS);
$manager->saveItem( $invoice );
Re: Aimeos manual order creation (webhook Stripe)
In the released versions, the language ID of the address is used for the e-mail language. In the dev-master branch a fall-back to the language of the order is now implemented
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star