Payment Methods – How to Manage Recurring Profiles and Payment Methods

payment-methodsrecurring

I am creating a recurring profiles implementation for a payment method. I have create the required functions based on the class Mage_Payment_Model_Recurring_Profile_MethodInterface. My main struggle is how to physically create the new order.

Firstly I tried creating the order from the payment information as this contains order_info, order_item_info, billing_address_info and shipping_address_info. This had a problem when the payment failed that it was not working in the normal checkout way in terms using sales/service_quote and being able to roll back.

My question is this really. How should I work with the recurring profile to create the order "correctly" so that error cases work?

Looking at an example system it seems to simply create the order from the profile using Mage_Sales_Model_Recurring_Profile::createOrder but then in that case how would this work if the payment fails?

Best Answer

A successful payment does not create an order from a quotation. The customer confirmation creates the order. The payment is unrelated to this process. Think about COD, ship after received payment, invoiced orders in a b2b system. These are all examples of orders being created before the payment is received.

The customer has created this recurring profile and thus the intent has already been expressed to receive the goods and make the payment. It is a valid order. It should be created with status "awaiting payment", if your method cannot verify payment immediately and processed by the back office accordingly.

Related Topic