Home / Admin / WP Simple Pay: Translate Stripe Error Messages
Duplicate Snippet

Embed Snippet on Your Site

WP Simple Pay: Translate Stripe Error Messages

For more information about the available error codes and messages visit: https://stripe.com/docs/error-codes

Code Preview
php
<?php
/**
 * @link https://library.wpcode.com/snippet/rov9rl2l/
 */
add_filter(
	'simpay_get_localized_error_list',
	/**
	 * @param array $messages Stripe error messages. Keyed by error code.
 	 * @return array
 	 */
	function( $messages ) {
		// https://stripe.com/docs/error-codes#coupon-expired
		$messages['coupon_expired'] = 'The coupon has expired and is no longer valid';
		return $messages;
	}
);

Comments

Add a Comment