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?

  • can you please tell me whether default sales email is sent after placing order with default recurring profile product or not ? Jan 6, 2016 at 10:02

2 Answers 2


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.


So this is currently a work in progress but what I am aiming for with the recurring profiles is the following flow.

  1. User completes a checkout for a recurring profile product - this creates the user if needed and also the profile. It will link the payment alias to the profile so we can pay at a later date.
  2. Cron gets all profiles that need to be created and then creates all the orders.

How this is done technically is as follows.

We need a class for the payment type with implements Mage_Payment_Model_Recurring_Profile_MethodInterface.

The checkout process will call the function submitRecurringProfile. In here we save the customer and profile with the information needed.

public function submitRecurringProfile(
    Mage_Payment_Model_Recurring_Profile $profile,
    Mage_Payment_Model_Info $paymentInfo
    /** @var Mage_Sales_Model_Quote $oQuote */
    $quote = $paymentInfo->getQuote();

    /** @var Mage_Customer_Model_Customer $oCustomer */
    $customer = $quote->getCustomer();

    return $this;

The cron will load the profile it needs and then will call chargeRecurringProfile(Mage_Payment_Model_Recurring_Profile $recurringProfile)

In this function we then create the order from the information stored in the profile. There is a function createOrder that is on the profile class Mage_Sales_Model_Recurring_Profile. This takes in all the product information and then creates the order.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.