3

First of all i am working on this for past 3 days and still don't know what is causing this issue.

Following is the code.

$api_url = 'Soap URl';

$api_user = 'User';
$api_key = 'API key';

$proxy = new SoapClient($api_url);

    try {
  $sessionId = $proxy->login($api_user, $api_key);  
  $customers = $proxy->call($sessionId, 'customer.list', array(array('email' => '[email protected]')));  
  if(count($customers) == 0 ){  
    $customer_data = array(
        'email' => '[email protected]',
        'firstname' => 'ritesh',
        'lastname' => 'patadiya',
        'password' => 'test1234',
        'website_id' => 1,
        'store_id' => 1,
        'group_id' => 1
      );

    $customer = $proxy->call($sessionId,'customer.create',array($customer_data));
  }
  else{
    $customer = $customers[0];
  }
  $customer['mode'] = 'customer';
  $shoppingCartId = $proxy->call($sessionId, 'cart.create', array('1'));

  try{
    $resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array($shoppingCartId, $customer));
  } catch (Exception $ex){
    echo "cart customer set = ".$ex->getMessage();
  }

  $arrAddresses = array(
     array(
          "mode" => "shipping",
          "firstname" => "ritesh",
          "lastname" => "patadiya",
          "company" => "rb",
          "street" => "wall street",
          "city" => "rajkot",
          "region" => "gujarat",
          "postcode" => "4567892",
          "country_id" => "id",
          "telephone" => "0123456789",
          "fax" => "0123456789",
          "is_default_shipping" => 0,
          "is_default_billing" => 0
      ),
      array(
          "mode" => "billing",
          "firstname" => "ritesh",
          "lastname" => "patadiya",
          "company" => "rb",
          "street" => "wall street",
          "city" => "rajkot",
          "region" => "gujarat",
          "postcode" => "123456",
          "country_id" => "id",
          "telephone" => "0123456789",
          "fax" => "0123456789",
          "is_default_shipping" => 0,
          "is_default_billing" => 0
      )
  );

  try{
    $resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
  } catch (Exception $ex) {
    echo '<br />cart_customer.addresses'.$ex->getMessage();
  }

// Disable shipping method when product is virtual.

//  try{
//    $resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId));
//    $shippingMethod = $resultShippingMethods[0]["code"];
//    $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
//  } catch(Exception $ex){
//    echo '<br />cart_shipping.method'.$ex->getMessage();
//  }

  $arrProducts = array(
    array(
//      "sku" => "FBP001" // This is virtual product, we have modified price to 0.01
      "sku" => "DEM001R" // This is virtual product, we have modified price to 0.01
    )
  );  


  try{
    $resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));
  }
  catch(Exception $ex){
     echo '<br />cart_product.add'.$ex->getMessage();
  }

  try{
    $resultPaymentMethods = $proxy->call($sessionId, "cart_payment.list", array($shoppingCartId));
  } catch(Exception $ex){
     echo '<br />payment method'.$ex->getMessage();
  }

  $paymentMethod = array(
    'po_number' => null,
    'method' => $resultPaymentMethods[0]['code'],
    'cc_cid' => trim($_POST["cc_cid"]),
    'cc_owner' => trim($_POST["cc_owner"]),
    'cc_number' => trim($_POST["cc_number"]),
    'cc_type' => trim($_POST["cc_type"]), // AE = American Express, VI = Visa, MC = MasterCard, DI = Discover
    'cc_exp_year' => trim($_POST["cc_exp_year"]),
    'cc_exp_month' => trim($_POST["cc_exp_month"])
  );

  echo "<br />Method: ".$resultPaymentMethods[0]['code'];
  echo "<br />Cvv: ".$_POST["cc_cid"];
  echo "<br />Owner name: ".$_POST["cc_owner"];
  echo "<br />Card Number: ".$_POST["cc_number"];
  echo "<br />Type: ".$_POST["cc_type"];
  echo "<br />Ex year: ".$_POST["cc_exp_year"];
  echo "<br />Ex Month: ".$_POST["cc_exp_month"];
  echo "<br />";
  try{
    $resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));
  } catch(Exception $ex){
    echo '<br />cart_payment.method'.$ex->getMessage();
  }

  try{
    $cart_info = $proxy->call($sessionId, "cart.info", $shoppingCartId);
    echo "<pre>"; print_R($cart_info);
  } catch (Exception $ex) {
    echo "<br /> cart info = ".$ex->getMessage();
  }

  $result = "";
  try{
    $resultOrderCreation = $proxy->call($sessionId, "cart.order", array($shoppingCartId));    
    $result = $proxy->call($sessionId, 'sales_order.addComment', array('orderIncrementId' => $resultOrderCreation, 'status' => 'complete'));
  } catch(Exception $ex){
    print_r($result);
    echo "<br /> order = ".$ex->getMessage();
  }
} catch (Exception $ex) {
  echo "login = " . $ex->getMessage();
}
?>

we are testing with live authorize.net account (not in test mode). also one more thing manual orders are working fine.

Following is the response of cart.info

Array
(
    [store_id] => 1
    [created_at] => 2014-04-07 16:57:16
    [updated_at] => 2014-04-07 16:57:18
    [converted_at] => 
    [is_active] => 0
    [is_virtual] => 0
    [is_multi_shipping] => 0
    [items_count] => 1
    [items_qty] => 1.0000
    [orig_order_id] => 0
    [store_to_base_rate] => 1.0000
    [store_to_quote_rate] => 1.0000
    [base_currency_code] => USD
    [store_currency_code] => USD
    [quote_currency_code] => USD
    [grand_total] => 0.0100
    [base_grand_total] => 0.0100
    [checkout_method] => customer
    [customer_id] => 241
    [customer_tax_class_id] => 3
    [customer_group_id] => 1
    [customer_email] => [email protected]
    [customer_prefix] => 
    [customer_firstname] => ritesh
    [customer_middlename] => 
    [customer_lastname] => patadiya
    [customer_suffix] => 
    [customer_dob] => 
    [customer_note] => 
    [customer_note_notify] => 1
    [customer_is_guest] => 0
    [remote_ip] => 
    [applied_rule_ids] => 
    [reserved_order_id] => 
    [password_hash] => 
    [coupon_code] => 
    [global_currency_code] => USD
    [base_to_global_rate] => 1.0000
    [base_to_quote_rate] => 1.0000
    [customer_taxvat] => 
    [customer_gender] => 
    [subtotal] => 0.0100
    [base_subtotal] => 0.0100
    [subtotal_with_discount] => 0.0100
    [base_subtotal_with_discount] => 0.0100
    [is_changed] => 1
    [trigger_recollect] => 0
    [ext_shipping_info] => 
    [gift_message_id] => 
    [is_persistent] => 0
    [quote_id] => 800
    [shipping_address] => Array
        (
            [address_id] => 
            [quote_id] => 800
            [created_at] => 2014-04-07 16:57:17
            [updated_at] => 2014-04-07 16:57:18
            [customer_id] => 241
            [save_in_address_book] => 0
            [customer_address_id] => 
            [address_type] => shipping
            [email] => 
            [prefix] => 
            [firstname] => ritesh
            [middlename] => 
            [lastname] => patadiya
            [suffix] => 
            [company] => rb
            [street] => wall street
            [city] => rajkot
            [region] => gujarat
            [region_id] => 
            [postcode] => 4567892
            [country_id] => id
            [telephone] => 0123456789
            [fax] => 0123456789
            [same_as_billing] => 1
            [free_shipping] => 0
            [collect_shipping_rates] => 1
            [shipping_method] => 
            [shipping_description] => 
            [weight] => 0.0000
            [subtotal] => 0.0000
            [base_subtotal] => 0.0000
            [subtotal_with_discount] => 0.0000
            [base_subtotal_with_discount] => 0.0000
            [tax_amount] => 0.0000
            [base_tax_amount] => 0.0000
            [shipping_amount] => 0.0000
            [base_shipping_amount] => 0.0000
            [shipping_tax_amount] => 0.0000
            [base_shipping_tax_amount] => 0.0000
            [discount_amount] => 0.0000
            [base_discount_amount] => 0.0000
            [grand_total] => 0.0000
            [base_grand_total] => 0.0000
            [customer_notes] => 
            [applied_taxes] => a:0:{}
            [discount_description] => 
            [shipping_discount_amount] => 
            [base_shipping_discount_amount] => 
            [subtotal_incl_tax] => 0.0000
            [base_subtotal_total_incl_tax] => 
            [hidden_tax_amount] => 
            [base_hidden_tax_amount] => 
            [shipping_hidden_tax_amount] => 
            [base_shipping_hidden_tax_amnt] => 
            [shipping_incl_tax] => 0.0000
            [base_shipping_incl_tax] => 0.0000
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
            [gift_message_id] => 
        )

    [billing_address] => Array
        (
            [address_id] => 
            [quote_id] => 800
            [created_at] => 2014-04-07 16:57:17
            [updated_at] => 2014-04-07 16:57:18
            [customer_id] => 241
            [save_in_address_book] => 0
            [customer_address_id] => 
            [address_type] => billing
            [email] => [email protected]
            [prefix] => 
            [firstname] => ritesh
            [middlename] => 
            [lastname] => patadiya
            [suffix] => 
            [company] => rb
            [street] => wall street
            [city] => rajkot
            [region] => gujarat
            [region_id] => 
            [postcode] => 123456
            [country_id] => id
            [telephone] => 0123456789
            [fax] => 0123456789
            [same_as_billing] => 0
            [free_shipping] => 0
            [collect_shipping_rates] => 0
            [shipping_method] => 
            [shipping_description] => 
            [weight] => 0.0000
            [subtotal] => 0.0100
            [base_subtotal] => 0.0100
            [subtotal_with_discount] => 0.0000
            [base_subtotal_with_discount] => 0.0000
            [tax_amount] => 0.0000
            [base_tax_amount] => 0.0000
            [shipping_amount] => 0.0000
            [base_shipping_amount] => 0.0000
            [shipping_tax_amount] => 0.0000
            [base_shipping_tax_amount] => 0.0000
            [discount_amount] => 0.0000
            [base_discount_amount] => 0.0000
            [grand_total] => 0.0100
            [base_grand_total] => 0.0100
            [customer_notes] => 
            [applied_taxes] => a:0:{}
            [discount_description] => 
            [shipping_discount_amount] => 0.0000
            [base_shipping_discount_amount] => 0.0000
            [subtotal_incl_tax] => 0.0100
            [base_subtotal_total_incl_tax] => 
            [hidden_tax_amount] => 0.0000
            [base_hidden_tax_amount] => 0.0000
            [shipping_hidden_tax_amount] => 0.0000
            [base_shipping_hidden_tax_amnt] => 
            [shipping_incl_tax] => 0.0000
            [base_shipping_incl_tax] => 0.0000
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
            [gift_message_id] => 
        )

    [items] => Array
        (
            [0] => Array
                (
                    [item_id] => 1307
                    [quote_id] => 800
                    [created_at] => 2014-04-07 16:57:17
                    [updated_at] => 2014-04-07 16:57:17
                    [product_id] => 99
                    [store_id] => 1
                    [parent_item_id] => 
                    [is_virtual] => 1
                    [sku] => DEM001R
                    [name] => Demo Monthly Subscription (Do Not Purchase)
                    [description] => 
                    [applied_rule_ids] => 
                    [additional_data] => 
                    [free_shipping] => 0
                    [is_qty_decimal] => 0
                    [no_discount] => 0
                    [weight] => 
                    [qty] => 1
                    [price] => 0.0100
                    [base_price] => 0.0100
                    [custom_price] => 
                    [discount_percent] => 0.0000
                    [discount_amount] => 0.0000
                    [base_discount_amount] => 0.0000
                    [tax_percent] => 0.0000
                    [tax_amount] => 0.0000
                    [base_tax_amount] => 0.0000
                    [row_total] => 0.0100
                    [base_row_total] => 0.0100
                    [row_total_with_discount] => 0.0000
                    [row_weight] => 0.0000
                    [product_type] => subscription_virtual
                    [base_tax_before_discount] => 
                    [tax_before_discount] => 
                    [original_custom_price] => 
                    [redirect_url] => 
                    [base_cost] => 
                    [price_incl_tax] => 0.0100
                    [base_price_incl_tax] => 0.0100
                    [row_total_incl_tax] => 0.0100
                    [base_row_total_incl_tax] => 0.0100
                    [hidden_tax_amount] => 0.0000
                    [base_hidden_tax_amount] => 0.0000
                    [gift_message_id] => 
                    [weee_tax_disposition] => 0.0000
                    [weee_tax_row_disposition] => 0.0000
                    [base_weee_tax_disposition] => 0.0000
                    [base_weee_tax_row_disposition] => 0.0000
                    [weee_tax_applied] => a:0:{}
                    [weee_tax_applied_amount] => 0.0000
                    [weee_tax_applied_row_amount] => 0.0000
                    [base_weee_tax_applied_amount] => 0.0000
                    [base_weee_tax_applied_row_amnt] => 
                    [qty_options] => Array
                        (
                        )

                    [tax_class_id] => 0
                    [is_recurring] => 
                    [has_error] => 
                )

        )

    [payment] => Array
        (
            [payment_id] => 
            [quote_id] => 800
            [created_at] => 2014-04-07 16:57:18
            [updated_at] => 2014-04-07 16:57:18
            [method] => authorizenet
            [cc_type] => VI
            [cc_number_enc] => 
            [cc_last4] => 5636
            [cc_cid_enc] => 
            [cc_owner] => Hardik Raval
            [cc_exp_month] => 11
            [cc_exp_year] => 2021
            [cc_ss_owner] => 
            [cc_ss_start_month] => 
            [cc_ss_start_year] => 
            [po_number] => 
            [additional_data] => 
            [cc_ss_issue] => 
            [additional_information] => Array
                (
                )

            [paypal_payer_id] => 
            [paypal_payer_status] => 
            [paypal_correlation_id] => 
        )

)

Getting this error: Credit card number mismatch with credit card type.

3
  • 2
    stackoverflow.com/a/10716297/158325
    – B00MER
    Apr 7, 2014 at 17:37
  • 2
    This means, if you are not PCI-DSS certified you should NEVER have the cc number, so you can't send it to the API. If you are certified, you can "just save the cc number" and everything is fine. Apr 7, 2014 at 19:13
  • @FabianBlechschmidt feel free to add an answer here if you have time :) May 26, 2014 at 9:21

1 Answer 1

3

I'm not so into PCI-DSS but long story short (and maybe wrong! ;-))

To save CC numbers, the credit card companies expect, that your application and infrastructure is PCI-DSS certified. More can be found about this on wikipedia.

So to "save" the cc number at any time (e.g. sending it via form to the server, "saving" it in the memory and just forward it to any credit card processing company) or just save it and then process it manually, you need this certification.

That said, I think that Authorize.net is implemented as pci-dss conform as possible, which means, the data is sent to authorize.net and not saved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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