Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('woocommerce_stripe_woocommerce_addon_error','woocommerce_stripe_woocommerce_addon_error_overide',10,1) ;
- function woocommerce_stripe_woocommerce_addon_error_overide($body){
- if($body['error']['type'] == 'invalid_request_error' ){
- $error = 'Please make sure you have entered the credit card number.';
- }
- if($body['error']['type'] == 'incorrect_number' ){
- $error = 'The card number is incorrect.';
- }
- if($body['error']['code'] == 'card_declined' ){
- $error = 'The card has been declined.';
- }
- 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_error' ){
- $error = 'The card was declined from gateway.';
- }
- 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 ;
- }
Add Comment
Please, Sign In to add comment