diff --git a/commerce_idpay.module b/commerce_idpay.module
index 8e8ed56..d0f3ab9 100644
--- a/commerce_idpay.module
+++ b/commerce_idpay.module
@@ -65,11 +65,13 @@ function commerce_idpay_redirect_form($form, &$form_state, $order, $payment_meth
   $callback = url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], ['absolute' => TRUE]);
 
   // Gateway endpoint.
-  $url = 'https://api.idpay.ir/v1/payment';
+  $url = 'https://api.idpay.ir/v1.1/payment';
   $params = array(
     'order_id' => $order->order_id,
     'amount' => $amount_decimal,
+    'name' => '',
     'phone' => '',
+    'mail' => '',
     'desc' => t('Order number #') . $order->order_id,
     'callback' => $callback,
   );
@@ -145,9 +147,10 @@ function commerce_idpay_redirect_form_validate($order, $payment_method) {
   $id = $_POST['id'];
   $order_id = $_POST['order_id'];
   $amount = $_POST['amount'];
+  $card_no = $_POST['card_no'];
   $date = $_POST['date'];
 
-  if($order->order_id != $order_id) {
+  if ($order->order_id != $order_id) {
     // Checks if somebody is trying to abuse the transaction callback.
     drupal_set_messsage(t('Abuse of transaction callback.'), 'error');
     watchdog('commerce_idpay',
@@ -162,92 +165,109 @@ function commerce_idpay_redirect_form_validate($order, $payment_method) {
     return FALSE;
   }
 
-  // Before we inquiry for a payment at the IDPay endpoint, we must look for an
+  // Before we verify for a payment at the IDPay endpoint, we must look for an
   // internal transaction.
   if ($transaction = commerce_idpay_load_transaction($id, $order_id)) {
-    // Gateway endpoint.
-    $url = 'https://api.idpay.ir/v1/payment/inquiry';
-    $params = array(
-      'id' => $transaction->remote_id,
-      'order_id' => $transaction->order_id,
-    );
 
-    $headers = array(
-      'Content-Type' => 'application/json',
-      'X-API-KEY' => $payment_method['settings']['api_key'],
-      'X-SANDBOX' => ($payment_method['settings']['sandbox'] ? 'true' : 'false'),
-    );
+    if ($status == 10) {
+      // Gateway endpoint.
+      $url = 'https://api.idpay.ir/v1.1/payment/verify';
+      $params = array(
+        'id' => $transaction->remote_id,
+        'order_id' => $transaction->order_id,
+      );
+
+      $headers = array(
+        'Content-Type' => 'application/json',
+        'X-API-KEY' => $payment_method['settings']['api_key'],
+        'X-SANDBOX' => ($payment_method['settings']['sandbox'] ? 'true' : 'false'),
+      );
 
-    try {
-      $response = drupal_http_request($url, array(
-        'method' => 'POST',
-        'headers' => $headers,
-        'data' => json_encode($params),
-      ));
+      try {
+        $response = drupal_http_request($url, array(
+          'method' => 'POST',
+          'headers' => $headers,
+          'data' => json_encode($params),
+        ));
 
-      if ($response->code == 200) {
-        // In this case the gateway will send a message in json format.
-        $result = json_decode($response->data);
-        if ($result->status == 100) {
-          // According to the gateway documentation, when the status is equal to 100,
-          // the payment is successful.
-          // Therefore we will save the transaction as a successful of one.
-          // Otherwise we will save it as a failed transaction.
-          commerce_idpay_update_transaction($transaction, $result->track_id, $result->status, $result->card_no, COMMERCE_PAYMENT_STATUS_SUCCESS);
-          commerce_payment_redirect_pane_next_page($order);
-          watchdog('commerce_idpay', 'Payment succeeded.');
-          return TRUE;
+        if ($response->code == 200) {
+          // In this case the gateway will send a message in json format.
+          $result = json_decode($response->data);
+          if ($result->status >= 100) {
+            // According to the gateway documentation, when the status is equal to 100,
+            // the payment is successful.
+            // Therefore we will save the transaction as a successful of one.
+            // Otherwise we will save it as a failed transaction.
+            commerce_idpay_update_transaction($transaction, $result->track_id, $result->status, $result->payment->card_no, COMMERCE_PAYMENT_STATUS_SUCCESS);
+            commerce_payment_redirect_pane_next_page($order);
+            watchdog('commerce_idpay', 'Payment succeeded.');
+            return TRUE;
+          }
+          else {
+            commerce_idpay_update_transaction($transaction, $result->track_id, $result->status, $card_no, COMMERCE_PAYMENT_STATUS_FAILURE);
+            commerce_payment_redirect_pane_previous_page($order);
+            drupal_set_message(t("Payment failed with status code: %code.", array(
+              '%code' => $result->status,
+            )), 'error');
+            watchdog('commerce_idpay',
+              'Payment failed with status code: %code.', array(
+                '%code' => $result->status,
+              ),
+              WATCHDOG_ERROR
+            );
+            return FALSE;
+          }
         }
-        else {
-          commerce_idpay_update_transaction($transaction, $result->track_id, $result->status, $result->card_no, COMMERCE_PAYMENT_STATUS_FAILURE);
-          commerce_payment_redirect_pane_previous_page($order);
-          drupal_set_message(t("Payment failed with status code: %code.", array(
-            '%code' => $result->status,
-          )), 'error');
+        elseif ($response->code >= 400 && $response->code < 500) {
+          $error_response = json_decode($response->data);
+          drupal_set_message(t($error_response->error_message), 'error');
           watchdog('commerce_idpay',
-            'Payment failed with status code: %code.', array(
-              '%code' => $result->status,
+            'Payment failed. This is due to an error with http code: %http_code, error_code: %error_code and error_message: "@error_message" when accessing the verification endpoint: !url',
+            array(
+              '%http_code' => $response->code,
+              '%error_code' => $error_response->error_code,
+              '@error_message' => $error_response->error_message,
+              '!url' => $url,
             ),
             WATCHDOG_ERROR
           );
+          commerce_idpay_update_transaction($transaction, $track_id, $status, '', COMMERCE_PAYMENT_STATUS_FAILURE);
+          commerce_payment_redirect_pane_previous_page($order);
           return FALSE;
         }
-      }
-      elseif ($response->code >= 400 && $response->code < 500) {
-        $error_response = json_decode($response->data);
-        drupal_set_message(t($error_response->error_message), 'error');
-        watchdog('commerce_idpay',
-          'Payment failed. This is due to an error with http code: %http_code, error_code: %error_code and error_message: "@error_message" when accessing the inquiry endpoint: !url',
-          array(
-            '%http_code' => $response->code,
-            '%error_code' => $error_response->error_code,
-            '@error_message' => $error_response->error_message,
-            '!url' => $url,
-          ),
-          WATCHDOG_ERROR
-        );
-        commerce_idpay_update_transaction($transaction, $track_id, $status, '', COMMERCE_PAYMENT_STATUS_FAILURE);
-        commerce_payment_redirect_pane_previous_page($order);
-        return FALSE;
-      }
-      elseif ($response->code >= 500) {
-        drupal_set_messsage(t('Payment failed.'), 'error');
-        watchdog('commerce_idpay',
-          'Payment failed. This is due to an error with http code: %http_code when accessing the inquiry endpoint: !url',
-          array(
-            '%http_code' => $response->code,
-            '!url' => $url,
-          ),
-          WATCHDOG_ERROR
-        );
-        commerce_idpay_transaction($payment_method, $order, $id, $track_id, $status, COMMERCE_PAYMENT_STATUS_FAILURE);
-        commerce_payment_redirect_pane_previous_page($order);
+        elseif ($response->code >= 500) {
+          drupal_set_messsage(t('Payment failed.'), 'error');
+          watchdog('commerce_idpay',
+            'Payment failed. This is due to an error with http code: %http_code when accessing the verification endpoint: !url',
+            array(
+              '%http_code' => $response->code,
+              '!url' => $url,
+            ),
+            WATCHDOG_ERROR
+          );
+          commerce_idpay_transaction($payment_method, $order, $id, $track_id, $status, COMMERCE_PAYMENT_STATUS_FAILURE);
+          commerce_payment_redirect_pane_previous_page($order);
 
-      }
+        }
 
-    } catch (\Exception $e) {
-      drupal_set_message(t($e->getMessage()), 'error');
+      } catch (\Exception $e) {
+        drupal_set_message(t($e->getMessage()), 'error');
+        commerce_payment_redirect_pane_previous_page($order);
+      }
+    }
+    else {
+      commerce_idpay_update_transaction($transaction, $track_id, $status, $card_no, COMMERCE_PAYMENT_STATUS_FAILURE);
       commerce_payment_redirect_pane_previous_page($order);
+      drupal_set_message(t("Payment failed with status code: %code.", array(
+        '%code' => $status,
+      )), 'error');
+      watchdog('commerce_idpay',
+        'Payment failed with status code: %code.', array(
+          '%code' => $status,
+        ),
+        WATCHDOG_ERROR
+      );
+      return FALSE;
     }
   }
   else {
