diff --git a/mercado_pago_payment.sdk.inc b/mercado_pago_payment.sdk.inc
index a9a5298..ad41931 100644
--- a/mercado_pago_payment.sdk.inc
+++ b/mercado_pago_payment.sdk.inc
@@ -40,6 +40,40 @@ function mercado_pago_payment_sdk_settings_form($settings = NULL) {
     '#default_value' => (isset($settings['mp_mode'])) ? $settings['mp_mode'] : 'modal',
   );
 
+  if(module_exists('commerce_license')){
+    $form['recurring_payment'] = array(
+      '#type' => 'fieldset', 
+      '#title' => t('Recurring Payment Options'), 
+      '#collapsible' => TRUE, 
+      '#collapsed' => TRUE,
+    );
+    $form['recurring_payment']['recurring'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Recurring Payment'),
+      '#description' => t('select if this will be a recurring payment'),
+      '#default_value' => (isset($settings['recurring_payment']['recurring'])) ? trim($settings['recurring_payment']['recurring']) : FALSE,
+      '#required' => FALSE,
+    );
+    $form['recurring_payment']['frecuency'] = array(
+      '#type' => 'select',
+      '#title' => t('Frecuency Type'),
+      '#options' => array(
+        'days' => t('Days'),
+        'months' => t('Months'),
+      ),
+      '#default_value' => (isset($settings['recurring_payment']['frecuency'])) ? trim($settings['recurring_payment']['frecuency']) : 'months',
+      '#description' => t('Indicates the period of time. Might be: days or months'),
+    );
+    $form['recurring_payment']['frecuency_amount'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Amount of Time'),
+      '#description' => t('Amount of time (in days or months) for the execution of the next payment'),
+      '#default_value' => (isset($settings['recurring_payment']['frecuency_amount'])) ? trim($settings['recurring_payment']['frecuency_amount']) : 1,
+      '#required' => FALSE,
+    );
+
+  }
+
   $form['sandbox'] = array(
     '#type' => 'checkbox',
     '#title' => t('Sandbox mode'),
@@ -182,7 +216,7 @@ function mercado_pago_payment_sdk_redirect_form($form, &$form_state, $order, $pa
   // If provided, get the cart name and cart surname.
   $cart_name = '';
   $cart_surname = '';
-  if(!empty($order->commerce_customer_billing) && !empty($order_wrapper->commerce_customer_billing->commerce_customer_address)){
+  if(!empty($order->commerce_customer_billing) && !empty($wrapper->commerce_customer_billing->commerce_customer_address)){
     $billing_address = $wrapper->commerce_customer_billing->commerce_customer_address->value();
     if (empty($billing_address['first_name'])) {
       $name_parts = explode(' ', $billing_address['name_line']);
@@ -192,8 +226,31 @@ function mercado_pago_payment_sdk_redirect_form($form, &$form_state, $order, $pa
     $cart_name = $billing_address['first_name'];
     $cart_surname = $billing_address['last_name'];
   }
-
-  // Setting preference for MP.
+  $settings = $payment_method['settings'];
+  
+//check if commercer license exists and there's one created for this order.
+  if(module_exists('commerce_license') && $wrapper->commerce_line_items[0] != NULL && $wrapper->commerce_line_items[0]->commerce_license != NULL && $wrapper->commerce_line_items[0]->commerce_license->license_id->value() != NULL)
+    $commerce_lincense_id = $wrapper->commerce_line_items[0]->commerce_license->license_id->value();
+  else
+    $commerce_lincense_id =FALSE;
+//it's a preprroval?
+  if($commerce_lincense_id && isset($settings['recurring_payment']['recurring']) && $settings['recurring_payment']['recurring']){
+      // Setting preference for prepapproval MP.
+    $preference = array(
+    'payer_email' => $order->mail,
+    'reason'=> 'Magic Tour Subscription',
+    'back_url' => $url_return,
+    'external_reference' => $order->order_id . '-' . REQUEST_TIME,
+  );
+    $preference['auto_recurring']=array(
+      'frequency'=>$settings['recurring_payment']['frecuency_amount'],
+      'frequency_type'=>$settings['recurring_payment']['frecuency'],
+      'transaction_amount' => round(commerce_currency_amount_to_decimal($amount, $currency_code), 2),
+      'currency_id'=>$currency_code,
+    );    
+  }
+  else{
+      // Setting preference for MP.
   $preference = array(
     'items' => array(
       array(
@@ -224,10 +281,12 @@ function mercado_pago_payment_sdk_redirect_form($form, &$form_state, $order, $pa
     // 'notification_url' => url('mercado_pago_payment_sdk/ipn/' . $payment_method['instance_id'], 
     //   array('absolute' => TRUE)),
     'external_reference' => $order->order_id . '-' . REQUEST_TIME,
-  );
+    );
+  }
 
+watchdog('preferences','<pre>'.print_r($preference,TRUE).'</pre>');
   // Exclude payment methods.
-  $settings = $payment_method['settings'];
+
   if (isset($settings['methods']['excluded_payment_methods'])) {
     $methods = array();
     foreach ($settings['methods']['excluded_payment_methods'] as $method) {
@@ -281,7 +340,12 @@ function mercado_pago_payment_sdk_redirect_form($form, &$form_state, $order, $pa
 
   // Creating the preferences.
   try{
-    $preference_result = $mp->create_preference($preference);
+    if($commerce_lincense_id && isset($settings['recurring_payment']['recurring']) && $settings['recurring_payment']['recurring']){
+      $preference_result = $mp->create_preapproval_payment($preference);
+    }else{
+      $preference_result = $mp->create_preference($preference);  
+    }
+    
   }catch (Exception $e) {
     // In case of comunication error, notify the user and create a back button.
     watchdog('mercado_pago_sdk', 'Comuncation with MercadoAPI fail. <br /> Message: <pre>!message</pre>',
@@ -365,7 +429,7 @@ function _mercado_pago_payment_sdk_validate_ipn($payment_method = NULL) {
     exit;
   }
 
-  if (!isset($ipn["topic"]) || $ipn["topic"] != "payment") {
+  if (!isset($ipn["topic"]) || !($ipn["topic"] == "payment" || $ipn["topic"] == "preapproval" || $ipn["topic"] == "authorized_payment" )) {
     watchdog('mercado_pago_sdk', 'IPN URL accessed with no "topic" or not set to "payment" on POST data submitted.',
       array(), WATCHDOG_WARNING);
     drupal_add_http_header('Status', '401 ERROR');
@@ -401,117 +465,241 @@ function _mercado_pago_payment_sdk_validate_ipn($payment_method = NULL) {
     $mp->sandbox_mode(FALSE);
   }
 
-  try {
-    $payment_info = $mp->get_payment_info('' . $ipn["id"]);
-  }
-  catch (Exception $e) {
-    watchdog('mercado_pago_sdk', 'An error occurred when processing payment with id = %id.<br /> Message: <pre>!message</pre>',
+switch ($ipn["topic"]) {
+  case 'payment':
+    try {
+      $payment_info = $mp->get_payment_info('' . $ipn["id"]);
+    }
+    catch (Exception $e) {
+      watchdog('mercado_pago_sdk', 'An error occurred when processing payment with id = %id.<br /> Message: <pre>!message</pre>',
       array('%id' => $ipn["id"], '!message' => $e->getMessage()), WATCHDOG_ERROR);
-    drupal_add_http_header('Status', '401 ERROR');
-    echo 'Caught exception: ',  $e->getMessage(), "\n";
-    exit;
-  }
+      drupal_add_http_header('Status', '401 ERROR');
+      echo 'Caught exception: ',  $e->getMessage(), "\n";
+      exit;
+    }
 
-  if ($payment_info['status'] != '200') {
-    watchdog('mercado_pago_sdk', 'An error occurred when processing payment with id = %id.',
-      array('%id' => $ipn["id"]), WATCHDOG_ERROR);
-    drupal_add_http_header('Status', '401 ERROR');
-    echo "Error:199";
-    exit;
-  }
+    if ($payment_info['status'] != '200') {
+      watchdog('mercado_pago_sdk', 'An error occurred when processing payment with id = %id.',
+        array('%id' => $ipn["id"]), WATCHDOG_ERROR);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo "Error:199";
+      exit;
+    }
 
-  list($order_id) = explode('-', $payment_info['response']['collection']['external_reference']);
+    list($order_id) = explode('-', $payment_info['response']['collection']['external_reference']);
 
-  if (!$order_id || empty($order_id)) {
-    watchdog('mercado_pago_sdk', 'La información enviada no pudo ser procesada, el parametro "external_reference" es no valido. <pre>%posted_info</pre>',
-      array('%posted_info' => print_r($payment_info, TRUE)), WATCHDOG_INFO);
-    drupal_add_http_header('Status', '401 ERROR');
-    echo "Error:208";
-    exit;
-  }
+    if (!$order_id || empty($order_id)) {
+      watchdog('mercado_pago_sdk', 'La información enviada no pudo ser procesada, el parametro "external_reference" es no valido. <pre>%posted_info</pre>',
+        array('%posted_info' => print_r($payment_info, TRUE)), WATCHDOG_INFO);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo "Error:208";
+      exit;
+    }
 
-  $order = commerce_order_load($order_id);
-  if ($order == False) {
-    watchdog('mercado_pago_sdk', 'Error when trying to load order #%order_id referred in PayPal IPN notification (id = %id).<br /> Order #%order_id do not exist. <br />IPN info: <pre>%message</pre>',
-      array('%order_id' => $order_id, '%id' => $ipn["id"], '%message' => print_r($payment_info, TRUE)), WATCHDOG_ERROR);
-    drupal_add_http_header('Status', '401 ERROR');
-    echo 'Caught exception: Order do not exist', "\n";
-    exit;
-  }
+    $order = commerce_order_load($order_id);
+    if ($order == False) {
+      watchdog('mercado_pago_sdk', 'Error when trying to load order #%order_id referred in PayPal IPN notification (id = %id).<br /> Order #%order_id do not exist. <br />IPN info: <pre>%message</pre>',
+        array('%order_id' => $order_id, '%id' => $ipn["id"], '%message' => print_r($payment_info, TRUE)), WATCHDOG_ERROR);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo 'Caught exception: Order do not exist', "\n";
+      exit;
+    }
 
-  $wrapper = entity_metadata_wrapper('commerce_order', $order);
-  $currency_code = $wrapper->commerce_order_total->currency_code->value();
+    $wrapper = entity_metadata_wrapper('commerce_order', $order);
+    $currency_code = $wrapper->commerce_order_total->currency_code->value();
 
-  $transaction = NULL;
-  $transactions = commerce_payment_transaction_load_multiple(array(), array('remote_id' => $ipn["id"]));
-  if (!empty($transactions)) {
-    $transaction = current($transactions);
-  }
+    $transaction = NULL;
+    $transactions = commerce_payment_transaction_load_multiple(array(), array('remote_id' => $ipn["id"]));
+    if (!empty($transactions)) {
+      $transaction = current($transactions);
+    }
 
-  if ($transaction == NULL) {
-    $transaction = commerce_payment_transaction_new('mercado_pago_payment_sdk', $order->order_id);
-    $transaction->instance_id = $payment_method['instance_id'];
-  }
+    if ($transaction == NULL) {
+      $transaction = commerce_payment_transaction_new('mercado_pago_payment_sdk', $order->order_id);
+      $transaction->instance_id = $payment_method['instance_id'];
+    }
 
-  // Verify that the order and IPN notificacion have the same currency code, or else, use IPNs
-  $mp_currency_code = $payment_info['response']['collection']['currency_id'];
-  if ($currency_code != $mp_currency_code) {
-    watchdog('mercado_pago_sdk', t('The currency code is different between MP(%mp_code) and your order(%order_code). Using %mp_code .'), 
-      array('%mp_code'=>$mp_currency_code, '%order_code'=>$currency_code), WATCHDOG_NOTICE);
-    $currency_code = $mp_currency_code;
-  }
+    // Verify that the order and IPN notificacion have the same currency code, or else, use IPNs
+    $mp_currency_code = $payment_info['response']['collection']['currency_id'];
+    if ($currency_code != $mp_currency_code) {
+      watchdog('mercado_pago_sdk', t('The currency code is different between MP(%mp_code) and your order(%order_code). Using %mp_code .'), 
+        array('%mp_code'=>$mp_currency_code, '%order_code'=>$currency_code), WATCHDOG_NOTICE);
+      $currency_code = $mp_currency_code;
+    }
 
-  $transaction->remote_id = $ipn["id"];
-  $transaction->amount = commerce_currency_decimal_to_amount($payment_info['response']['collection']['transaction_amount'], $currency_code);
-  $transaction->currency_code = $currency_code;
-  $transaction->payload[REQUEST_TIME] = $payment_info;
+    $transaction->remote_id = $ipn["id"];
+    $transaction->amount = commerce_currency_decimal_to_amount($payment_info['response']['collection']['transaction_amount'], $currency_code);
+    $transaction->currency_code = $currency_code;
+    $transaction->payload[REQUEST_TIME] = $payment_info;
+
+    switch ($payment_info['response']['collection']['status']) {
+      case 'approved':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
+        $transaction->message = 'Pago acreditado';
+        break;
+
+      case 'cancelled':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Mercadopago cancelado';
+        break;
+
+      case 'in_mediation':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'El pago entró en disputa';
+        break;
+
+      case 'in_process':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'Su Mercadopago está pendiente de acreditación';
+        break;
+
+      case 'pending':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'Mercadopago pendiente, aún no se realiza deposito';
+        break;
+
+      case 'refunded':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Pago reintegrado a la contraparte';
+        break;
+
+      case 'rejected':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Mercadopago rechazado';
+        break;
+
+      case 'uninitialized':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Se abandonó el pago en el medio del proceso';
+        break;
+
+      default:
+        // No action.
+        break;
+    }
+    break;
+  case 'preapproval':
+    try {
+      $payment_info = $mp->get_preapproval_payment('' . $ipn["id"]);
+    }
+    catch (Exception $e) {
+      watchdog('mercado_pago_sdk', 'An error occurred when processing preapproval with id = %id.<br /> Message: <pre>!message</pre>',
+      array('%id' => $ipn["id"], '!message' => $e->getMessage()), WATCHDOG_ERROR);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo 'Caught exception: ',  $e->getMessage(), "\n";
+      exit;
+    }
 
-  switch ($payment_info['response']['collection']['status']) {
-    case 'approved':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
-      $transaction->message = 'Pago acreditado';
-      break;
+    if ($payment_info['status'] != '200') {
+      watchdog('mercado_pago_sdk', 'An error occurred when processing payment with id = %id.',
+        array('%id' => $ipn["id"]), WATCHDOG_ERROR);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo "Error:199";
+      exit;
+    }
 
-    case 'cancelled':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
-      $transaction->message = 'Mercadopago cancelado';
-      break;
+    list($order_id) = explode('-', $payment_info['response']['external_reference']);
 
-    case 'in_mediation':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
-      $transaction->message = 'El pago entró en disputa';
-      break;
+    if (!$order_id || empty($order_id)) {
+      watchdog('mercado_pago_sdk', 'La información enviada no pudo ser procesada, el parametro "external_reference" es no valido. <pre>%posted_info</pre>',
+        array('%posted_info' => print_r($payment_info, TRUE)), WATCHDOG_INFO);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo "Error:208";
+      exit;
+    }
 
-    case 'in_process':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
-      $transaction->message = 'Su Mercadopago está pendiente de acreditación';
-      break;
+    $order = commerce_order_load($order_id);
+    if ($order == False) {
+      watchdog('mercado_pago_sdk', 'Error when trying to load order #%order_id referred in PayPal IPN notification (id = %id).<br /> Order #%order_id do not exist. <br />IPN info: <pre>%message</pre>',
+        array('%order_id' => $order_id, '%id' => $ipn["id"], '%message' => print_r($payment_info, TRUE)), WATCHDOG_ERROR);
+      drupal_add_http_header('Status', '401 ERROR');
+      echo 'Caught exception: Order do not exist', "\n";
+      exit;
+    }
 
-    case 'pending':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
-      $transaction->message = 'Mercadopago pendiente, aún no se realiza deposito';
-      break;
+    $wrapper = entity_metadata_wrapper('commerce_order', $order);
+    $currency_code = $wrapper->commerce_order_total->currency_code->value();
 
-    case 'refunded':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
-      $transaction->message = 'Pago reintegrado a la contraparte';
-      break;
+    $transaction = NULL;
+    $transactions = commerce_payment_transaction_load_multiple(array(), array('remote_id' => $ipn["id"]));
+    if (!empty($transactions)) {
+      $transaction = current($transactions);
+    }
 
-    case 'rejected':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
-      $transaction->message = 'Mercadopago rechazado';
-      break;
+    if ($transaction == NULL) {
+      $transaction = commerce_payment_transaction_new('mercado_pago_payment_sdk', $order->order_id);
+      $transaction->instance_id = $payment_method['instance_id'];
+    }
 
-    case 'uninitialized':
-      $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
-      $transaction->message = 'Se abandonó el pago en el medio del proceso';
-      break;
+    // Verify that the order and IPN notificacion have the same currency code, or else, use IPNs
+    $mp_currency_code = $payment_info['response']['auto_recurring']['currency_id'];
+    if ($currency_code != $mp_currency_code) {
+      watchdog('mercado_pago_sdk', t('The currency code is different between MP(%mp_code) and your order(%order_code). Using %mp_code .'), 
+        array('%mp_code'=>$mp_currency_code, '%order_code'=>$currency_code), WATCHDOG_NOTICE);
+      $currency_code = $mp_currency_code;
+    }
 
-    default:
-      // No action.
-      break;
+    $transaction->remote_id = $ipn["id"];
+    $transaction->amount = commerce_currency_decimal_to_amount($payment_info['response']['auto_recurring']['transaction_amount'], $currency_code);
+    $transaction->currency_code = $currency_code;
+    $transaction->payload[REQUEST_TIME] = $payment_info;
+
+    switch ($payment_info['response']['status']) {
+      case 'authorized':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;
+        $transaction->message = 'Pago acreditado';
+        break;
+
+      case 'cancelled':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Mercadopago cancelado';
+        break;
+
+      case 'paused':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'El pago entró en disputa';
+        break;
+
+      case 'in_process':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'Su Mercadopago está pendiente de acreditación';
+        break;
+
+      case 'pending':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
+        $transaction->message = 'Mercadopago pendiente, aún no se realiza deposito';
+        break;
+
+      case 'refunded':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Pago reintegrado a la contraparte';
+        break;
+
+      case 'rejected':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Mercadopago rechazado';
+        break;
+
+      case 'uninitialized':
+        $transaction->status = COMMERCE_PAYMENT_STATUS_FAILURE;
+        $transaction->message = 'Se abandonó el pago en el medio del proceso';
+        break;
+
+      default:
+        // No action.
+        break;
+      }
+    break;
+  case 'authorized_payment':
+    //TODO Implement future payment actions.
+    break;
+  default:
+    //TODO Supossed to not reach here (see mercado_pago_payment_sdk_redirect_form()) 
+    exit;
+    break;
+}
 
-  }
+watchdog('payment_info','<pre>'.print_r($payment_info,TRUE).'</pre>');
 
   commerce_payment_transaction_save($transaction);
   // $posted_info['transaction_id'] = $transaction->transaction_id;
