How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3531 by valentin.manthei
17 Oct 2016, 18:45
Hello,

thanks for your great software.

I would like to use aimeos for subscriptions, e.g. if you purchase the product "One package of toilet paper every month".

What is the best approach to add these features to aimeos? Should the user do a normal checkout and then I'll add new orders programatically every month?

For payments there could be two approaches:
- Save payment data locally and bill the user with a new order using the payment interface.
- Create a subscription (e.g. using stripe) and add orders when the payment gateway sends success calls.

Thank you for any input.

Also, is there any documentation for the integrated DirectDebit payment service?

Best regards,
Valentin
#3543 by aimeos
19 Oct 2016, 15:03
valentin.manthei wrote:I would like to use aimeos for subscriptions, e.g. if you purchase the product "One package of toilet paper every month". What is the best approach to add these features to aimeos? Should the user do a normal checkout and then I'll add new orders programatically every month?


Doing subscriptions for single products of an order wouldn't be feasible I think (payment issues and others) but reoccurring orders are possible. Aimeos already has some infrastructure for this because the order details (mshop_order_base* tables) are separate from the order ID and status (mshop_order and mshop_order_status).

The user must do a normal checkout but must chose e.g. in the delivery step that the order should be recurring and the time frame. This could be done by a service decorator (https://aimeos.org/docs/Developers/Library/Service) like these ones: https://github.com/aimeos/aimeos-core/tree/master/lib/mshoplib/src/MShop/Service/Provider/Decorator

Afterwards, a job controller would have to create a new entry in the mshop_order table and call the payment service provider to do the payment again (https://aimeos.org/docs/Developers/Controller/Implement_job_controller)

valentin.manthei wrote:For payments there could be two approaches:
- Save payment data locally and bill the user with a new order using the payment interface.
- Create a subscription (e.g. using stripe) and add orders when the payment gateway sends success calls.


I would strongly vote for a payment gateway that supports recurring payments by sending back an identifier for further payments. Storing e.g. credit card data locally is only allowed if your system is PCI-DSS compliant and that's an expensive certification.

valentin.manthei wrote:Also, is there any documentation for the integrated DirectDebit payment service?


The direct debit implementation is very simple:
https://github.com/aimeos/aimeos-core/blob/master/lib/mshoplib/src/MShop/Service/Provider/Payment/DirectDebit.php