Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author syednazrulhassan

    (@nazrulhassanmca)

    1- make sure you add all 3 ,card no ,expiry and cvc
    2- make sure you try with default twentyfifteen theme
    3- Next Please follow this thread

    Plugin Author syednazrulhassan

    (@nazrulhassanmca)

    before proceeding with above steps make sure to add following line of code to your functions.php

    
    add_filter('woocommerce_stripe_woocommerce_addon_error','woocommerce_stripe_woocommerce_addon_error_overide',$error) ;
    
    function woocommerce_stripe_woocommerce_addon_error_overide($body){
    
    	if($body['error']['type'] == 'invalid_request_error' ){
    
    		$error = 'Please make sure you have entered the correct credit card details.';
    	}
    
    	if($body['error']['type'] == 'incorrect_number' ){
    
    		$error = 'The card number is incorrect.';
    	}
    	if($body['error']['type'] == 'invalid_number' ){
    
    		$error = 'The card number is not a valid credit card number.';
    	}
    	if($body['error']['type'] == 'invalid_expiry_month' ){
    
    		$error = 'The card\'s expiration month is invalid.';
    	}
    	if($body['error']['type'] == 'invalid_expiry_year' ){
    
    		$error = 'The card\'s expiration year is invalid.';
    	}
    	if($body['error']['type'] == 'invalid_cvc' ){
    
    		$error = 'The card\'s security code is invalid.';
    	}
    	if($body['error']['type'] == 'expired_card' ){
    
    		$error = 'The card has expired.';
    	}
    	if($body['error']['type'] == 'incorrect_cvc' ){
    
    		$error = 'The card\'s security code is incorrect.';
    	}
    	if($body['error']['type'] == 'incorrect_zip' ){
    
    		$error = 'The card\'s zip code failed validation.';
    	}
    	if($body['error']['type'] == 'card_declined' ){
    
    		$error = 'The card was declined.';
    	}
    	if($body['error']['type'] == 'missing' ){
    
    		$error = 'There is no card on a customer that is being charged.';
    	}
    	if($body['error']['type'] == 'processing_error' ){
    
    		$error = 'An error occurred while processing the card.';
    	}
    	if($body['error']['type'] == 'rate_limit' ){
    
    		$error = 'An error occurred due to requests hitting the API too quickly. Please let us know if you\'re consistently running into this error.';
    	}
    	
    	return $error  ; 
    
    }
    

    Thanks

    I’m having the same issue when a customer puts in incorrect information, problem is that they don’t get any error message. “Invalid source object: must be a dictionary or a non-empty string.”

    Where is “fuctions.php” and is the above code used to tell the customer that the card has been declined, that would be great.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Invalid source object: must be a dictionary or a non-empty string. See API docs’ is closed to new replies.