1
votes

I am using stripe credit card payment method for website on my magento store and developing a mobile application. I am developing the api's using native magento api. Problem occurred on create order api, everything till adding payment for stripe credit card works fine but when I hit the create order api it throws the exception. "Credit card number mismatch with credit card type exception"

Below is api code, Please share your knowledge for this issue. Thanks in advance.

$proxy = new SoapClient($this->_client); //soap handle
    $sessionId = $proxy->login($this->_apiuser, $this->_apikey);
    $resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
    if ($resultCustomerAddresses != TRUE) 
    {
       return json_encode(array('status' => 0, 'result' => array(),'message' => 'Error in saving  address'));
    } 
    $resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId));
    $randShippingMethodIndex = rand(0, count($resultShippingMethods)-1 );
    $shippingMethod = $resultShippingMethods[$randShippingMethodIndex]["code"];

    $resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shipping_method));

    //$resultTotalOrder = $proxy->call($sessionId,'cart.totals',array($shoppingCartId));

    $paymentMethod = array(
        "method" => $payment_method
    );

    $resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $payment_method));

    $licenseForOrderCreation = null;

    $resultOrderCreation = $proxy->call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
1

1 Answers

1
votes

I had the same problem and successfully solved it, see this answer: https://stackoverflow.com/a/41948259/1052675

Basically, you supply the card information before you save the quote. It will validate the card against regex patterns and configured purchase limits and make sure you can use the payment method.

Then it will forget the payment information.

So before you tell it to submit the order, you need to supply the card info again.

My solution was a custom endpoint for simplicity on the front end app and it enabled me to keep the card info in memory to re-save between saving the quote and submitting the order.