I managed to fix it with this code
function mounir_enqueue_scripts() {
/**
* frontend ajax requests.
*/
wp_enqueue_script( 'mycred-sell-this' );
wp_localize_script(
'mycred-sell-this',
'myCREDBuyContent',
array(
'ajaxurl' => esc_url( ( isset( $post->ID ) ) ? mycred_get_permalink( $post->ID ) : home_url( '/' ) ),
'token' => wp_create_nonce( 'mycred-buy-this-content' ),
'working' => "Processing ...",
'reload' => "1",
'sweeterror' => __( 'Error', 'mycred' )
)
);
}
add_action( 'wp_enqueue_scripts', 'mounir_enqueue_scripts', 9999999999999999999999999999999999999999999 );