0

I am using mage api to genertae order but when i generate order using shoppingCartOrder function it gives error "Credit card number mismatch with credit card type."

$proxy->shoppingCartPaymentMethod($sessionId, $quoteId, array(
                    'po_number'    => 'null',
                    'method'       => 'paypal_direct',
                    'cc_cid'       => '123',
                    'cc_owner'     => 'test',
                    'cc_number'    => '4111111111111111',
                    'cc_type'      => 'VI',
                    'cc_exp_year'  => '2022',
                    'cc_exp_month' => '12'
                    )); 

    $cart_order_result=$proxy->shoppingCartOrder($sessionId, $quoteId);
  • I've seen this myself with older version of Magento and Paypal Direct. This must be a bug with Paypal. – philwinkle Sep 29 '14 at 0:28
1

The credit card number is checked against the type using regex, this can be found in Mage_Payment_Model_Method_Cc::validate

But for visa it uses the regex 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', so what it needs is a 4 followed by 12 digits, with an optional 3 digits at the end.

It appears that your number is valid but for some reason the type is still the default OT in the validate code. I would suggest you look into this regex loop to see what is actually happening with your value.

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.